Programming in C ++ under Windows , I got used to the fact that MS compilers are not backward compatible, therefore libraries are compiled separately for vc10, vc12, vc14. The task of porting the application to mingw has become, here are versions 4.8, 4.9, 5.3. What is the situation with backward compatibility? If I compile the library in 4.8, can I link to the application at 4.9? And on 5.3?

Update

Not quite clear comments about the IDE. I usually try to do it so that a project can be built by executing a script, with only a compiler present.

A more specific example: I developed a library for serializing classes in an xml file, compiled a library with vc10, we have an h-file, a lib file for linking and a dll file for execution. I link this library without any problems and use it with applications compiled on vc10. I can easily link the library with the project vc12. But here at performance I will receive segmentation fault or other similar problems. Trite, because std::string in vc10 and vc12 are implemented a little differently (maybe not std::string , but something else).

So the actual question: I compiled the library with the help of migw 4.8, I will get the lib, dll. Will I be able to use these lib and dll to build the program under mingw 5.3, without rebuilding my library under 5.3?

  • four
    If I remember correctly, binary compatibility is guaranteed within the major version. That is, binaries from 4.8 and 4.9 will be compatible, but 5.3 and 4.8 - and who knows. In general, you need to google on the topic of gcc abi - KoVadim
  • I ran into problems when I compiled code 4.8, and the boost was compiled 5.3 (the code that initialized just the string from the error_code.message ()) dropped. By default, it seems, we can assume that 4.x and 5.x are not compatible. - o2gy

1 answer 1

A new ABI appeared in gcc 5.1: https://gcc.gnu.org/onlinedocs/libstdc%2B%2B/manual/using_dual_abi.html

I think that was reflected in mingw too.

Therefore, for version 5.2, I advise first, at least, to set the _GLIBCXX_USE_CXX11_ABI macro value to 0 in order to use the old ABI.