Linkage problems porting appication from g++ to Sun Studio 11

I'm trying to port an application from g++ to the Sun Studio 11C++ compiler. The app uses the DBTools library which now won't link. I notice that the compiler is shipped with the tools.h++ library so I can link classes such as RWCString etc but when it comes to using the database classes RWDBManager etc, then I can't get these to link for what I presume is a different name mangling convention in g++ to that used in Sun CC.

Does anyone know if (a) there is a way to force the compiler to use same name mangling (b) if there is a version of DBTools.h++ around that IS link compatible with Sun Studio.

Reading another post it seems that I can't write a wrapper using extern "C" as this will not be compatible. Help!!

I just can't believe that you can't use that library with Sun Studio. There just has to be an easy solution to this.

Thanks, Nick.

[887 byte] By [Nick_Dunstonea] at [2007-11-27 4:39:44]
# 1

When linking object code produced by different compilers, the name mangling is the least important difference. C++ allows many degrees of freedom in laying out classes, implementing virtual functions, implementing exceptions, etc. If any of these details are different between two compilers, object code from the compilers will not work together. Compilers typically choose different name mangling schemes to prevent incompatible object code from linking accidentally.

For a detailed discussion of this issue, see my paper "The Stability of the C++ ABI:

http://developers.sun.com/sunstudio/articles/CC_abi/CC_abi_content.html

See also my answer to a question about g++ compatibility here:

http://forum.java.sun.com/thread.jspa?threadID=5173398

For a future compiler release, we plan to have an option to generate code that is binary compatible with selected versions of g++. (g++ is not in general compatible among different versions, so trying to be compatible with g++ is quite a challenge.)

clamage45a at 2007-7-12 9:50:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

I suggest you contact Rogue Wave support with questions related to porting our libraries

(or programs that use our libraries) from one compiler to another. Several versions of

Sun C++ (starting with 5.3 all the way up the most recent version) as well as a number

of versions of gcc are on our certification and support matrix for every release of our

products.

You can view the support matrices here:

http://www.roguewave.com/support/matrices/index.cfm

Here's a link to our support page:

http://www.roguewave.com/support/

In response to Steve's comment about Sun's plan to make it possible to generate object

code that's compatible with gcc: that's awesome! FWIW, here's some useful info on gcc

ABI stability and the compatibility of the compiler:

http://gcc.gnu.org/onlinedocs/gcc/Compatibility.html

sebor@roguewave.coma at 2007-7-12 9:50:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...