Visual C++ - Linking plugin DLL against EXE?

后端 未结 4 1321
甜味超标
甜味超标 2021-02-04 13:34

I\'m in the process of porting a large C++ application from Linux (gcc) to Windows (Visual C++ 2008) and am having linker issues with plugins. On Linux this wasn\'t an issue, as

4条回答
  •  花落未央
    2021-02-04 14:07

    I have been implementing the same, constructing a plugin library to build under both Linux and Windows.

    The solution under Linux is to use the -rdynamic option in the gcc command line. This exports all of the symbols in the main executable, so that a plugin can find them on loading.

    Under Windows, the solution is to add __declspec(dllexport) in front of the definition of those functions in the exe that you want the dlls to use. Compilation will create a .lib file for the dlls to link to. Certainly works under Visual studio 2008. Related post: https://stackoverflow.com/a/3756083/1486836

提交回复
热议问题