How can one link Visual C++ (2010) console app with a STATIC library created by MinGW (*.a format)? Is it compatible with Visual C++ 2010?
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not compatible.
However, if you extract all the object files from the library (use
ar), the VC++ linker is able to deal with those (I tested it, although I used cygwin gcc rather than mingw gcc). Note that you may still have name mangling problems if you don’t useextern "C".You may of course use VC++’s
LIB.EXEtool to make these into a static library in VC++ format.As @Michael points out, you will definitely have problems if you try to pass non-POD C++ objects between modules built with different compilers. The fix for this is the same as the DLL case: write a wrapper built with the same compiler (in this case mingw) that exposes a C-compatible interface usable from other toolchains.