Re: Same symbol, two libraries
- From: u.int.32.t@xxxxxxxxx
- Date: 26 Apr 2006 12:38:15 -0700
Frank Cusack wrote:
On 24 Apr 2006 13:35:27 -0700 u.int.32.t@xxxxxxxxx wrote:
I'm using two libraries (really two versions of the same), lib7.so and
lib8.so.
Both of these define symbols keep and update.
In my executable, I want to use lib7.so's version of keep and lib8.so's
version of update.
Any ideas on how I can do this?
If you know the link order, you can use dlsym() to get both versions of
keep/update. Since you know the link order, you'll know which is which.
If you don't know the link order, you can dlopen() the libraries yourself
before calling dlsym().
You might want to do this in an interposed library (LD_PRELOAD) instead
of in your app.
If you have the source for the libraries, make keep and update weak aliases
for keep_lib7 and keep_lib8. Then you can just call the specific version
instead of the alias in your app (perhaps by #define rather than at runtime).
You could create a shared lib which defines filters for keep and update
and link against that before linking against lib7 and lib8. Those filters
would point to the appropriate versions.
There might be a way to use direct binding and ild to link against lib7
first, for keep, then lib8 for update.
I've tried the dlsym method and the problem is that when keep is called
from v7, calls within keep resolve to calls for the newer library,
which result in coredumps... I'll google a bit more.
.
- Follow-Ups:
- Re: Same symbol, two libraries
- From: Paul Pluzhnikov
- Re: Same symbol, two libraries
- References:
- Same symbol, two libraries
- From: u . int . 32 . t
- Re: Same symbol, two libraries
- From: Frank Cusack
- Same symbol, two libraries
- Prev by Date: Re: Solaris NDIS Wrapper Toolkit and usb wifi dongle
- Next by Date: Re: pkg installs
- Previous by thread: Re: Same symbol, two libraries
- Next by thread: Re: Same symbol, two libraries
- Index(es):
Relevant Pages
|