Operating System - HP-UX
1828793 Members
2834 Online
109985 Solutions
New Discussion

Linker error with aCC created shared library and g++ created shared library

 
SOLVED
Go to solution
Sri111
Occasional Contributor

Linker error with aCC created shared library and g++ created shared library

Hi all:
I have a shared library compiled with HP-UX 10.20 "aCC complier" that I am trying to link with the shared library generated by the "g++ complier"

I am getting the linker error as follows:
ld: Unsatisfied shared library symbols:
main (code)
ld: Unsatisfied symbols:
__nw__FUi (code)
parseRequest__6MyExampleFPCc (code)

I hope that there must be at least one way to link the shared library generated by aCC and the shared library generated by g++

The command i used to create the shared library by g++ is as follows:
g++ -fpic -shared -c MyExample.cpp

The command i used to create the shared library by aCC is as follows:
/opt/aCC/bin/aCC +z +u4 -c ACCExample.cpp

The command i used to link is as follows:
ld +n +vshlibunsats -o libServer.sl ACCExample.o MyExample.o /usr/lib/dld.sl /usr/ccs/lib/crt0.o -L/lib/pa1.1 -L/usr/lib/pa1.1 -L/usr/local/lib/gcc-lib/hppa1.1
-hp-hpux10.20/3.0.2 -L/usr/ccs/bin -L/usr/ccs/lib -L/opt/langtools/lib -L/usr/local/lib -lstdc++ -lm -lgcc -lc

Has anybody seen this problem or have an idea how to fix it?

Waiting for the help...Please do help

Thanks a lot.
2 REPLIES 2
Steven Gillard_2
Honored Contributor
Solution

Re: Linker error with aCC created shared library and g++ created shared library

Sorry, its not possible. aCC and g++ both have different name mangling algorithms (which is the process of turning a Class::function(arg) name into a symbol name in the object code). One will not recognise a symbol name generated by the other and you will get unsatisfied symbols as you have seen.

If all your code is true C++ then your only choice is to stick to the one compiler.

If any of the code is straight C compiled as C++ then you may be able to work around it by using extern "C" directives. See http://docs.hp.com/hpux/onlinedocs/dev/aCC/a_03_30/otherlangs.htm#OtherLanguages for more info on this.

Regards,
Steve
Sri111
Occasional Contributor

Re: Linker error with aCC created shared library and g++ created shared library

Hi Steve:
Thanks a lot for your reply...I had done that coding in C++ instead of java.

Your answer helped me to put a full stop in putting my efforts in that direction.
Sri