views:

27

answers:

1

I am porting a program to MS Windows. This program uses dynamically loaded plugins. The plugins reference symbols in the main program. I cannot even get the DLLs past the linker without all symbols being resolved. Is there a way to solve this?

A: 

(Sorry, I'd like to ask for clarification in a comment but I'm too much of a newbie to be allowed.)

When you say the plugins "reference symbols in the main program", is it about referencing functions or data? Also, what language/compiler are you using?

Assuming it's only about functions, and in C/C++: it's possible to export a function from a .EXE as if it were a DLL. Just specify __declspec(dllexport) in front of the function definition in the .EXE . When compiling the .EXE, a .LIB file should get generated, which you can then use as input when linking each plugin.

stephane.leclair
If I understand correctly you are suggesting that I link to a static library version of the program. That is a good idea to get copies of functions but that will not work if the functions reference global variables (including statics) becasuse they will be referencing a different copy of the variable. Actually I just presume that it would not work.
Rubinium