GCC 4.7, STL and binary compatibility of objects built with different language standards

Chase Douglas chase.douglas at canonical.com
Tue Jun 12 16:50:22 UTC 2012


On 06/12/2012 09:22 AM, Matthias Klose wrote:
> On 08.06.2012 17:10, Chris Coulson wrote:
>> I've just finished debugging a Unity crash which occurs when we try a
>> test rebuild of Unity and Nux with GCC4.7 in quantal. Although the
>> original issue was caused by mixing 2 C++ ABI's (because libsigc hasn't
>> been rebuilt yet in quantal), it was no better even after rebuilding
>> libsigc with the quantal toolchain.
> 
> correct, afaics there is no ABI incompatibility between 4.6 and 4.7, but between
> c++98 and c++0x/c++11.
> 
> c++98 and c++0x/c++11 code should not be mixed in one binary, and best avoided
> in a distribution.

My understanding is that this is only a problem if one library compiled
with one standard passes objects to another library compiled with
another standard. The following examples illustrate the difference:

* Nux (c++11) and libsigc++ (c++98) are compiled with different
standards. They pass std::lists between them. This is a problem.

* utouch-grail (c++11) and utouch-qml (c++98) are compiled with
different standards. However, the API between the two is pure C. This is
not a problem.

Please correct me if I am wrong.

In the uTouch team, we've been using c++11 features for core
functionality of our code. Most of utouch-frame and utouch-grail would
have to be rewritten if we needed to strip out c++11 support.
Thankfully, we aren't using nor exposing a C++ API other than the stl :).

-- Chase



More information about the ubuntu-devel mailing list