/usr/bin/ld: Unsatisfied Symbols: dlopen (code)..

On HPUX 11.0 I'm trying to compile and link an application that contains calls to dlopen, dlclose, dlerror and dlsym using gcc.  I receive the following error:

/usr/bin/ld:  Unsatisfied Symbols:
   dlerror (code)
   dlopen (code)
   dlclose (code)
   dlsym (code)

Can anyone tell me what switches are required to resolve the externals?  I've tried using -ldl and -ldld.

Thank you
Who is Participating?
kejinConnect With a Mentor Commented:
Answer to freewolf's Tuesday question:

Looks like they are going to provide a wrapper
in later release or they were decide to do so
before 11 and dropped the idea but forgot
to remove the include file. Anyway, I searched
all .sl, .o and .a file in my 11 box and couldn;t
find any of them defines dlopen etc..
AFAIK the subroutines are names sh_open(), sh_sym(), sh_free()
My man page for dlerror says to add -ldl to the compile command. If this does not work for you, I would try to locate
libdl.sl on your file system (/usr/lib?) and make sure your SHLIB_PATH variable points to that directory. Alternatively, you can specify the directory on the compiler command line using the -L <path> option.

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

HPUX doesn't support dlxxx() API. You should
use shl_load()/shl_findsym()/etc. to implement
them (or use a third party wrapper). The linking
option to use shl_xxx() is -ldld.
treewolfAuthor Commented:
Help me understand, if HPUX 11.0 doesn't support dlopen ... why does it include a man page and the appropriate header file dlfcn.h?

Thank you.
shl_load() ??
has it changed in 10.xx, in 9.x it was shl_open()
To ahoffmann's Tuesday question:

Check your manual. It is always shl_load() including 9.x. I only know one variant in 9.x. To support C++ global constructor/destructor,  one should use xxshl_load()/xxshl_unload(). This has already been integrated into shl_load/unload since 10.x
kejin, thanks for the additional info
treewolfAuthor Commented:
Thank you for your help.  How did you search the libraries for the dlopen reference, maybe I can try it on my machines?

Thank you again.
for f in /usr/lib/*.sl /usr/lib/*.o ....
echo $f
nm $f | grep dlopen

Sorry, I am not good at shell programming,
this is only a pseudo shell script.
looks good, this pseudo shell ;-)
just would add -gop options to nm (not shure if HP supports -g, but does -o and -p) and then | grep T
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.