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:07:52PM +0000, David Laight wrote:
> 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.

Don't forget other shared objects that are opened later.

Joerg


Home | Main Index | Thread Index | Old Index