Hey,
I checked this feature on my system, and it works perfectly. This is what I did:
Code:
#include <stdio.h>
#include <stdlib.h>
void *__real_malloc(size_t);
void *__wrap_malloc(size_t c)
{
printf("My MALLOC called: %d\n", c);
return __real_malloc(c);
}
int main (int argc, char *argv[])
{
void *ptr = malloc(12);
return 0;
}
And I compiled & run the code with:
Code:
[gcc wrap]$ gcc wrap.c -o wrap -Wl,-wrap,malloc
[gcc wrap]$ ./wrap
My MALLOC called: 12
I'm using
* gcc 4.4.3
* binutils 2.20.0.20091101
Maybe, you could post your code ...
- Andi -