C++/en: Difference between revisions

Updating to match new version of source page
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 49: Line 49:


====Linking with older previously compiled binaries====
====Linking with older previously compiled binaries====
The transition from GCC version 4.9 to version 5.1 introduced a major change to its ABI. If all source code including all dependent libraries is recompiled using the same version of the compiler then there will be no issues. If different compilers are used, the ABI change may cause linking to fail. The latter is likely to occur if you are linking to precompiled libraries provided in a vendor's product. If this occurs, you can use GCC's Dual ABI<ref>Free Software Foundation. The GNU C++ Library, Chapter 3. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html</ref> feature to tell GCC to use the old ABI in order for your application to link properly with those legacy libraries, e.g., you would pass <code>-D_GLIBCXX_USE_CXX11_ABI=0</code> to GCC if using GCC v5.1 or higher to link to libraries built using the older ABI.
The transition from GCC version 4.9 to version 5.1 introduced a major change to its ABI. If all source code including all dependent libraries is recompiled using the same version of the compiler then there will be no issues. If different compilers are used, the ABI change may cause linking to fail. The latter is likely to occur if you are linking to precompiled libraries provided in a vendor's product. If this occurs, you can use GCC's [https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html Dual ABI] feature to tell GCC to use the old ABI in order for your application to link properly with those legacy libraries, e.g., you would pass <code>-D_GLIBCXX_USE_CXX11_ABI=0</code> to GCC if using GCC v5.1 or higher to link to libraries built using the older ABI.


We've provided an example of how the ABI is affected by various GCC command-line options here: [[GCC C++ Dual ABI]].
We've provided an example of how the ABI is affected by various GCC command-line options here: [[GCC C++ Dual ABI]].
38,763

edits