[cfe-dev] libc++ ABI stability

Howard Hinnant hhinnant at apple.com
Mon May 23 13:08:23 PDT 2011


On May 23, 2011, at 2:27 PM, Guido Berhoerster wrote:

> Hello,
> 
> does the LLVM project make (or plan to make) any commitment with
> regard to the ABI stability of libc++?

The plan is to keep the ABI semi-stable.  The high level parts of the library are ABI-versioned using the C++11 feature inline namespaces.  The current version is 1.  This is considered an ABI version.  And the ABI for any given version is meant to be fixed.

Every once in a great while (e.g. maybe for the next C++ standard), we could issue a new ABI, which would then live in a different inlined namespace (e.g. std::_2).  There would be config macro to choose the ABI.

Some lower-level parts of the library are not ABI versioned.  They live in namespace std only.  These will remain stable until the sun swells up and swallows the earth (after that I can't vouch for it).  These low level parts include:

* operator new/delete
* get/set new_handler
* typeinfo
* the exception classes

The exception classes not only have a stable ABI, their ABI is identical to that of gcc-4.2.  This means you can throw exceptions across dyld boundaries and not worry which C++ std::lib the recipient of your exception is using (as long as that library is also ABI compatible with gcc-4.2).

Howard




More information about the cfe-dev mailing list