bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with weak symbols needed (gcc question).


From: Farid Hajji
Subject: Re: Help with weak symbols needed (gcc question).
Date: Tue, 24 Jul 2001 14:54:51 +0200

> On Mon, Jul 23, 2001 at 04:07:57AM +0200, Farid Hajji wrote:
> > What is the "official" way to wrap library (e.g. glibc) functions with
> > user-defined code, without fiddling in the glibc sources themselves?
> 
> Look into fakeroot, libtricks or even installwatch (all Debian packages).
> They seem to use RTLD_NEXT/dlopen and dlsym to get the real symbol, and wrap
> them in true_creat/next_creat or whatever.
Ahh... yes. That's _exactly_ what I was looking for.

> However, there are some tricks involved.  From a quick glance at the
> fakeroot source, you should not dlopen the C library directly, but just use
> RTLD_NEXT (so the linker will do the right thing for you).  Makes sense, of
> course, as we don't know what other libraries are preloaded or in the path
> (optimized versions, or whatever).  For this to work with glibc, you need
> to define _GNU_SOURCE at the beginning of the library...
I'll have to play around with RTLD_NEXT/dlopen() and dlsym() first to
really understand it. Thanks for the warnings.

> As an exercise and test if you understood it correctly, port fakeroot to the
> Hurd please ;)
Well, that's a good exercise indeed ;-).

Thanks,

-Farid.

-- 
Farid Hajji -- Unix Systems and Network Admin | Phone: +49-2131-67-555
Broicherdorfstr. 83, D-41564 Kaarst, Germany  | farid.hajji@ob.kamp.net
- - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - -
One OS To Rule Them All And In The Darkness Bind Them... --Bill Gates.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]