This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: LD_PRELOAD and C++ code
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Dan Myers <dmyers at umiacs dot umd dot edu>
- Cc: binutils at sources dot redhat dot com
- Date: 17 Mar 2004 11:50:46 -0500
- Subject: Re: LD_PRELOAD and C++ code
- References: <20040317163847.GA1201@proline.umiacs.umd.edu>
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