Omer Mussaev <[EMAIL PROTECTED]> writes:

> gcc ./foo.c -Xlinker --wrap -Xlinker printf foo.c wraps.c ; ./a.out
     ^^^^^^^                                    ^^^^^

I suppose you need foo.c only once.

I am not sure I understand completely how that will help in this
situation. Suppose there is global symbol foo in both the program and
the shared library. Won't any reference to foo be resolved as
__wrap_foo in _both_ the program and the library? To prevent conflict,
either the program or the library must be modified to refer to
__real_foo. If that is the case, then isn't it simpler to modify the
globals' names in the code?

Maybe I am just dense... I'd like to learn the trick, if it works.

Another point that may or may not be relevant: -Xlinker is
gcc-specific.

-- 
Oleg Goldshmidt | BLOOMBERG L.P. (BFM) | [EMAIL PROTECTED]
"... We work by wit, and not by witchcraft;
 And wit depends on dilatory time." - W. Shakespeare.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to