Operating System - HP-UX
1752806 Members
5628 Online
108789 Solutions
New Discussion

Re: using aCC to link with libraries made using CC(cfront)

 
Alfred P. Bartholomai_1
Occasional Contributor

using aCC to link with libraries made using CC(cfront)

We have a bit of unusual situation here. I won't
get into why we need to do it this way. Only that, for the moment, we need to process ahead:

We have libraries we have made on HP-UX 10.2
with the C++( cfront ) compiler. We have released
this code and it is running well on a HP-UX 11i machine. Now our customer wants to use our public
API to build some of their own applications.
Our question is - are there any issues when
using the aCC to compile/link with libraries
built on a 10.2 machine the C++(cfront).

Has anyone done this ? Any issues we need to watch out for ?

Thank you for your help.

Fred Bartholomai
2 REPLIES 2
Stephen Keane
Honored Contributor

Re: using aCC to link with libraries made using CC(cfront)

One of the biggest issues you'll face is name mangling. Different C++ compilers can name mangle functions names etc in their own unique ways. For example a library built using gcc and accessed via an executable built using aCC wont work as the library functions will be invisible to the aCC compiler. The only way around it is to declare the functions as C style (to prevent the name mangling), but that requires the libraries to be rebuilt so they don't contain name mangled entries. I don't know whether that made an awful lot of sense! It's not generally a good idea to mix C++ compilers on a build, although as you say you may have your own reasons for doing so.

If you can't rebuild your libraries, you may be able to get around the problem by building a proxy library that wraps the name mangled entries in your existing libraries, but presents an un-name-mangled interface to the outside world, this would have to be built using cfront though.
Dennis Handly
Acclaimed Contributor

Re: using aCC to link with libraries made using CC(cfront)

>We have libraries we have made on HP-UX 10.20 with the C++ (cfront) compiler.

 

Code compiled on 10.20 can't be mixed with code compiled on later HP-UX versions.

Also code compiled with cfront can't be mixed with aC++.

 

>One of the biggest issues you'll face is name mangling.

 

That's the least of the worries since there were OS changes between 10.20 and 11.00.