2

Is it possible to use a static library that was compiled with mingw in a visual studio MSVC project? Both projects are C++. I haven't found a clear answer on that. Note that I'm talking about a static library and not a DLL.

J. Volkya
  • 993
  • 3
  • 14
  • 33
  • Mixing and matching with C++ compilers almost never works. The runtimes/name-mangling rules/etc are usually incompatible. That said, did you try it? – Carl Norum Mar 29 '12 at 15:41
  • 1
    Same as [(SO)Can I link object files made by one compile to those made by another one?](http://stackoverflow.com/questions/5728116/can-i-link-object-files-made-by-one-compile-to-those-made-by-another-one) – Attila Mar 29 '12 at 15:43
  • @Carl: I'm porting a very large project from Linux to Windows and I had partial success compiling it with mingw. I have a hard time compiling it with MSVC. However, our users will link our static library in Visual Studio. So I wanted a clear answer before embarking in a port for mingw. – J. Volkya Mar 29 '12 at 16:01
  • @Attila: Thanks for pointing me to that question. When I searched for an answer on StackOverflow, it somehow did not come up in the results... – J. Volkya Mar 29 '12 at 16:04

1 Answers1

4

No, it is not possible due to ABI for c++ is not standard and gcc's ABI differs from MSVC++ one.

Lol4t0
  • 12,444
  • 4
  • 29
  • 65