开发者

dynamic linking msvc compiled dlls in g++

I have a DLL file along with corresponding LIB file compiled with VC++ 08. Now I want to dynamically开发者_StackOverflow中文版 link it with another application I am compiling using g++.

  1. Is it possible?
  2. What linker options will I have to give in g++?


If the library exports C++ classes or functions, then you probably can't, as the name-mangling between the two compilers is different. If it exports C functions, then you simply need to use the export library (the .LIB file) on the command line. For example, if it is called mylib.lib:

g++ afile.cpp another.cpp mylib.lib -o myexe

The DLL itself will have to be located in a suitable location, as it would be for a VC++ application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜