From: Paul M. <pf_...@ya...> - 2008-09-04 14:26:56
|
Is it possible to build an EXE in such a way that loaded DLLs can link back to symbols in the main executable? To be specific, given myprog.exe: main() utility_fn() mydll.dll dll_fn() can I set things up so that when main() loads mydll.dll and calls dll_fn(), then dll_fn() can see and hence use utility_fn() from the main executable. I'm not talking about passing pointers to functions here. I'm looking for a solution which doesn't require code changes - dll_fn() can call utility_fn() as a normal extern function, and get the one in the main program. I've heard something somewhere about writing a forwarder DLL which contains aliases making the function names refer to symbols in the EXE, but I couldn't get this to work on a quick try. It may be that I made a mistake, so a simple working example would be a real help! Thanks, Paul. |