Equivalent of GCC ld's --wrap
I need to find an equivalent to using gcc ld's --wrap option, e.g. with gcc
if I call ld with -Wl,--wrap,malloc, calls to malloc will instead be directed to _wrapmalloc. If I want to call the original malloc I can explicitly call _realmalloc.
With cctools ld (aka Apple's ld), there is no --wrap option. I can get halfway by using the "-idefinition:indirect" option using mangled symbol names, so can happily redirect malloc/whatever to my own function. However, I'm stuggling to find a solution so that I can call the original function.
Anyone got any ideas?
thanks
twoohnine
iBook G3, Mac OS X (10.4.7), gcc 4.0.1, ld cctools-622.3.obj~2