wrap functions in glibc
吴曦
wu.andrew.xi@gmail.com
Wed Nov 21 11:56:00 GMT 2007
Hi
As indicated in gcc maunal and ld manual,
Using "-Wl,--wrap -Wl,wraper_func_name" can provide a wrapper function
for certain interface in the program. However, I found this doesn't
work for function calls in the shared library.
for example, if I use
-Wl,--wrap -Wl,malloc
to wrap the malloc function, I can wrap the calls to malloc in my
code, but the malloc called in library cannot be wrapped. I think this
is because --wrap option is managed by linker, while it cannot replace
calls to malloc in library with wrapper functions.
However, if I want to wrap function calls in library (e.g. memcpy),
what should I do?
Any hints on this problem is truly appreciated.
Andrew
More information about the Gcc-help
mailing list