|
| | Subject: | wrap functions in glibc | | Group: | Gcc-help | | From: | ÎâêØ | | Date: | 21 Nov 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
|