dlopen() sees some symbols, but not others
- From: "Rob Y" <ryampolsky@xxxxxxxxx>
- Date: 27 Dec 2006 14:25:57 -0800
I want to load a shared library and have it access symbols in my main
executable. I've been able to get this to work by building the main
executable with -brtl and -bexpall. But, even though I've told the
linker to 'export all' symbols, not all are automatically available.
For example, I wanted a module with some utility functions to be
available to the loaded library, but since the main app doesn't call
any of those functions, I added a stub module to the main app with a
call to one of these functions in order to force the utility module to
be linked to the main app.
That worked for the most part - my dlopen'd code was able to call
functions in that module. But a function called FormatElement(), which
was in that module was unresolvable by dlopen(). In fact, another
function calaled LogFormattedElement() in the same source module was
resolvable and calls FormatElement() internally. As long as my
dlopen'd library called this second function, it worked.
Finally, I added a call to FormatElement() to my stub module to
explicitly 'link it in', and now it's resolvable by dlopen(). Since
this code was obviously there in the first place, and I used -bexpall,
shouldn't it just have been available?
.
- Follow-Ups:
- Re: dlopen() sees some symbols, but not others
- From: Gary R. Hook
- Re: dlopen() sees some symbols, but not others
- From: Paul Pluzhnikov
- Re: dlopen() sees some symbols, but not others
- Prev by Date: Re: AIX 5.3 Network Interface Backup and etherchannel setup
- Next by Date: Re: dlopen() sees some symbols, but not others
- Previous by thread: jfs2 filesystem crash???
- Next by thread: Re: dlopen() sees some symbols, but not others
- Index(es):