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:58:20 +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?
>
> I'm not sure there is an automatic way of doing this. But practical
> experience suggests that most of these "weak symbols" are declared
> in the following way:
> weak_alias (__foo, foo)
> So all you need to do is call __foo() from your user defined foo()
> function and that should work (in most cases). I think that's the
> simplest solution you can come up with.
Marcus' hint with RTLD, dlopen() and dlsym() seems more portable.
I've tried the _foo() and __foo() example with time(), and it didn't
work. That's why I asked in the first place ;-).

/tmp/cc64XxNW.o: In function `time':
/tmp/cc64XxNW.o(.text+0x6e): undefined reference to `__time'
collect2: ld returned 1 exit status

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]