I agree with dylwx(dylwx); Because their realization is easier than the later.
And the later uses exported function from exe file, this is very unusual and very skillful.
To sum up, there are two ways which can resolve your question. the former is more usual, only need to know how to use function pointer. and the later need to know exe file have the exported function as the same as DLL file.
I think, the ways is different. More import, the underling knowlege under the resolution to the question is crtial for all of us: programmers.