This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

wrap functions in glibc


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]