[cfe-dev] libc++ ABI stability

Howard Hinnant hhinnant at apple.com
Tue May 24 05:44:38 PDT 2011


On May 24, 2011, at 5:30 AM, Dallman, John wrote:

>> ... 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...
> 
> That's excellent news.
> 
> However, I take it new'ing an object in code that's using the GCC
> libstdc++ and delete'ing in code using libc++, or vice-versa,
> won't work?

It depends on how libstdc++ and libc++ are built.  If they both sit on top of the same libsupc++ or libc++abi, then memory ownership transfer is assured to be correct.

If they aren't built on the same foundation, then no, it is not assured.  However from a practical point of view, it will *probably* still work because they both just drop through to malloc/free.  But in that case, they will probably have different copies of the new handler.  If either side of the shared lib boundary is counting on the behavior of a custom new handler, then having two copies of it would be problematic.

Howard




More information about the cfe-dev mailing list