This is the mail archive of the
mailing list for the binutils project.
Re: Alternative to LD_PRELOAD
- From: Daniel Jacobowitz <drow at false dot org>
- To: arvind k <arvind_000 at yahoo dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 1 Jun 2006 11:31:16 -0400
- Subject: Re: Alternative to LD_PRELOAD
- References: <email@example.com>
On Thu, Jun 01, 2006 at 02:18:45AM -0700, arvind k wrote:
> My application is already linked with another shared
> library (say libb.so). So can I combine libb.so with
> liba.so using ld or gcc, so that both library code
> gets loaded when the application is executed?
Create a new shared library which depends on both libb.so and liba.so:
gcc -shared -Wl,-soname,libb1.so -o libb1.so -lb -la
Then arrange for that to be found when the application tries to open
libb.so. You'll need to mess around with search paths so that libb1.so
pulls in the original libb.so.