LD_PRELOAD and C++ code
Ian Lance Taylor
ian@wasabisystems.com
Wed Mar 17 16:50:00 GMT 2004
Dan Myers <dmyers@umiacs.umd.edu> writes:
> I have a question about using LD_PRELOAD/dlsym() to wrap library functions.
> Specifically, suppose I have some program compiled with gcc, and some shared
> library of wrapper functions that use C++ and are compiled with g++. Assuming
> the wrapper functions are declared extern "C", should I expect this to work?
> It seems to work in some cases but not in others, so I'm curious if anyone has
> a definitive answer.
If the wrapper functions are extern "C", and you are only passing them
C data types--no classes with virtual functions or references or
anything like that--then you can reasonably expect it to work.
Ian
More information about the Binutils
mailing list