Is GCC 4.7 compiled lib compatible with GCC 4.6.3?

I have a huge C ++ 11 project with plugins similar to a function. My project has several libraries (compiled with gcc 4.6.3), an interface (compiled with gcc 4.6.3), and some plugins (compiled with gcc 4.7). Plugins are loaded via tt dlopen and link to files from libs.

My project uses various types of templates, typeinfo, shared_ptr, stl.

When I compile everything with the same gcc version, everything works fine. When I compile the method I described (libs and frontend in 4.6.3 and the plugin in 4.7), I start to encounter problems.

I'm not sure what is going on, and I hope you can give me some tips and help me solve this problem.

+4
source share
2 answers

g ++ 4.6 compatible with 4.7, despite the fact that people here declare that you use libstdC ++ at runtime, therefore from the latest version used to build any object.

But for C ++ 11, there are fewer guarantees, because support is still developing (and until recently it was C ++ 11!), So we could not avoid some incompatible changes to improve C ++ 11.

For more information about your issues on the gcc-help mailing list and view it.

+4
source

From http://gcc.gnu.org/gcc-4.7/changes.html :

In versions 4.7.0 and 4.7.1 of GCC, changes were made to the standard C ++ library, which affected the operation of ABI in C ++ 11 mode: the data element was added to std :: list, changing its size and changing the definitions of some member functions and the std :: pair move constructor were non-trivial, which changed the calling convention for functions with std :: pair arguments or return types. ABI incompatibility has been fixed for GCC version 4.7.2, but as a result, C ++ 11 code compiled with GCC 4.7.0 or 4.7.1 may not be compatible with C ++ 11 code compiled with different versions of GCC and with C ++ 98 / C ++ 03, compiled with any version.

I had problems with std :: list <>

+4
source

Source: https://habr.com/ru/post/1414966/


All Articles