tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: __strong_alias
On Wed, Feb 13, 2013 at 06:43:12PM +0100, Emmanuel Dreyfus wrote:
> I have trouble to understand how __strong_alias should work. In the
> example below, I would expect libtest_foo() to be called after dlopen(),
> but it still use main_foo(). Anyone can explain?
dlopen() loads a library and uses the symbols of the program
to fixup undefined references in the library code.
If you want to reference anything in the library you need to
use dlsym().
If you specify RTLD_GLOBAL to dlopen(), then call via a PLT that
has not yet been initialised (because RTLD_LAZY was in effect
when the code making the call was loaded), then the function
in the library might get executed.
IMHO RTLD_GLOBAL should not have been invented!
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index