Steven Stallion wrote:
> On Fri, 29 May 2009 11:49:55 -0500, Shawn Walker <swalker at opensolaris.org>
> wrote:
>> *library* key phrase there :)
>>
>> In other words, if you deliver libfoo++, then applications or developers 
>> that want to use libfoo++ can't link against that library if they've 
>> been compiled with Sun Studio and vice versa.
>>
>> Applications compiled with g++ can only use libraries compiled with g++ 
>> and vice versa.
> 
> That is incorrect.

C++ has no ABI standard, so C++ libraries built with one compiler don't 
usually work with another one. In fact, even different versions of g++ 
(GNU C++ compiler) produce incompatible libraries. This means that in 
order to use C++ libraries in an application, the application must be 
built with the same compiler as the libraries. In the case of g++, you 
probably need the same version even.

You cannot mix binaries created by Sun Studio C++ with binaries created 
by g++. They are not compatible. It isn't just the name mangling that's 
different. Class layout, vtable structure, RTTI (type id) data, and 
exception handling are all completely different, for example.

There are many places that document various issues with mixing g++ 
compiled libraries and Sun Studio compiled applications/libraries:

http://pkgbuild.wiki.sourceforge.net/SFE_cpp_libs
http://wikis.sun.com/pages/viewpage.action?pageId=6455548
http://forums.sun.com/thread.jspa?threadID=5287218

Sun Studio 13 is supposed to have better (maybe complete?) support for 
the g++ abi, but that hasn't arrived yet afaik.

> By your logic then, libraries build with the GCC toolchain would not link
> on Solaris considering that GCC 3.4.3 uses the Solaris libc.

If it wasn't clear, I'm only talking about C++; not C.

There is no issue with C as far as I'm aware.

Cheers,
-- 
Shawn Walker

Reply via email to