dlopen, RTLD_GLOBAL and global variables
Ian Lance Taylor
ian@airs.com
Mon Mar 25 15:32:00 GMT 2002
Scott Moser LTC <ssmoser@us.ibm.com> writes:
> Any one have any ideas on how I can give applications access to global
> variables transparently through the wrapper library? Is this a problem with
> dlopen and RTLD_GLOBAL or something I'm not understanding correctly, or just
> missing (flags to ld...).
Without thinking about it too hard, it seems to me that you can just
define the global variables in your library. Then those variables
will take precedence over the ones in the libgtk shared library, and
all the references in libgtk will wind up referring to the ones you
defined. Of course, you must make sure that the variables which you
define are large enough.
Or perhaps you could use the LD_PRELOAD mechanism.
Ian
More information about the Binutils
mailing list