Operating System - HP-UX
1829093 Members
2448 Online
109986 Solutions
New Discussion

Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

 
SOLVED
Go to solution
Najam_1
Occasional Contributor

Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

Getting an unresolved symbol(__shlinit) error while building a shared library using aCC.
The source code is in C++.
The complete command for linking is...

/opt/aCC/bin/aCC -b -v +z -Wl,-v -o SCData.dll SCData.o SCProto.o
SCLoad.o pingwire.o VDCommon.o PinCache.o -lpthread
-L/usr/local/lib -lpcsclite -lc

aCC internally calls ld as...

/usr/ccs/bin/ld -b +nosmartbind -o SCData.dll shlrt0.o +I__shlinit
-u__shlinit -v SCData.o SCProto.o SCLoad.o pingwire.o VDCommon.o
PinCache.o -lpthread -L /usr/local/lib -lpcsclite -lc

error unresolved symbol: __shlinit (code) from SCData.dll

thanks
Naja
New to HP Unix
5 REPLIES 5
Steve Steel
Honored Contributor

Re: Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

Hi


Do you have the latest ld linker patch since this fixes a problem with shlinit


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steven Gillard_2
Honored Contributor
Solution

Re: Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

Does the shared library get built and function correctly? Does the error still appear if you do not use -v?

I suspect this can be ignored, because symbols in shared libs are resolved at runtime, not compile time. For what its worth __shlinit is defined in libCsup.sl.

Regards,
Steve

Najam_1
Occasional Contributor

Re: Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

Thanks for the reply,

If you are talking about the patch PHSS_26559 (s700_800 11.00 ld(1) and linker tools cumulative patch), yes I have it.

I am sorry I should have written this before, the error actually shows up at run time.

if you see in the ld command, aCC adds the option +I__shlinit -u__shlinit.

nm shlrt0.o
shows the symbol __shlInit, that is with the uppercase I.

If I explicitly call the ld command as aCC calls except for the options for __shlinit, I dont get the error at run time, but then the exported functions in my library(SCData.dll) does not seem to be called.

I am kind of running out of ideas.

Thanks
Naja
New to HP Unix
A. Clay Stephenson
Acclaimed Contributor

Re: Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

You should run ldd on your executable to see if the dynamic libraries are the ones you expect.

At run-time, you may need to set SHLIB_PATH and LD_LIBRARY_PATH to point to your desired library directories.

Man ldd and dld.sl for more details.
If it ain't broke, I can fix that.
Najam_1
Occasional Contributor

Re: Unresolved symbol(__shlinit) error, building a shared lib, using aCC.

Thanks Steven,

Explicitly linking with libCsup solves the problem.
just added -lCsup in the make file and the problem was solved.

Thanks to all of you for your help.
Najam
New to HP Unix