DLL Get Symbols From Its Parent (Loader)

北城以北 提交于 2019-12-20 03:07:24

问题


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?


回答1:


(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.



来源:https://stackoverflow.com/questions/3752634/dll-get-symbols-from-its-parent-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!