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++.
- Is it possible?
- 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.
精彩评论