You are not logged in.

#1 2008-06-04 02:07:51

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Make a library preload for only one application?

Is there a way to make a library preload only for a given binary? For instance, if I wanted only one application to preload libaoss.so, could I do that, or would I just have to preload it globally?

Offline

#2 2008-06-04 16:06:21

gnud
Member
Registered: 2005-11-27
Posts: 182

Re: Make a library preload for only one application?

Read http://www.quequero.org/Intercepting_with_LD_PRELOAD.

The answer you want is

#LD_PRELOAD="/usr/lib/libaoss.so" /path/to/yourbinary

Offline

#3 2008-06-04 16:29:37

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Make a library preload for only one application?

Thank you!

Edit: wait a minute, does putting this in /etc/profile work? Or will it execute that binary?

Putting things a bit better... What I'm looking for is a way to set things up so that a library is always preloaded for a given application, or several applications, when the binaries are executed.

Last edited by Gullible Jones (2008-06-04 16:32:47)

Offline

#4 2008-06-06 08:01:35

gnud
Member
Registered: 2005-11-27
Posts: 182

Re: Make a library preload for only one application?

Make startup scripts, and make sure that they appear in your $PATH before the real application(s) do.
I have a ~/bin folder for this sort of thing.

Offline

Board footer

Powered by FluxBB