This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: help: C++, SunStudio and gcc
- From: "John \(Eljay\) Love-Jensen" <eljay at adobe dot com>
- To: "worthnew" <worthnew at hotmail dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Mon, 25 Sep 2006 03:43:54 -0700
- Subject: RE: help: C++, SunStudio and gcc
- References: <6481411.post@talk.nabble.com>
Hi worthnew,
The SunStudio C++ ABI is not compatible with the GCC C++ ABI.
One of the significant shortcomings, in my opinion, of the C++ standard (ISO/IEC 14882-1998, TR-2003) is that the standards committee did not address the C++ ABI.
Although it is possible to get two different C++ compilers (or two different versions of the same C++ compiler with different ABIs) to compile, it is not a pleasant chore.
Your best bet is to get your vendor to compiler their library using GCC C++ (g++). In particular, the same GCC version you are using.
Anticipating your question, "What is the C++ ABI?"
Look at SDN's answer for "THE C++ ABI":
http://developers.sun.com/prodtech/cc/articles/CC_abi/CC_abi_content.html
All those items can differ from compiler to compiler. Or even from compiler version to compiler version.
One way to get two different C++ ABIs to interact is to write a "C bridge" between the two. The C bridge works because there is a standard C ABI. Having done that myself before, I can state vehemently that using a C bridge after the fact to glue to C++ systems together is unpleasant. Having a C++ implementation that uses a C API isn't so bad -- other than the nagging thought "Hey, this C API really looks object oriented... why didn't they provide a C++ API?" The reason that C++ implementation use C APIs is because the C ABI is specified, "the" C++ ABI is not.
Sincerely,
--Eljay