views:

41

answers:

1

Hi,

I know that using dlopen with RLTD_NOLOAD one can find out whether a shared object is already loaded or not. This, however, doesn't seem to work if a so is linked to the executable and loaded by the linker during application startup.

I mean, lets say I have mylib.so and load it with dlopen. Later, if I make dlopen with RLTD_NOLOAD, I get the handle as expected.

However, if I link mylib.so to the application ( -lmylib at the makefile ) dlopen returns NULL.

How can I get a handle to the shared object if it is directly linked to the exec. and not loaded explicitly?

Thanks in Advance

A: 

This is way too late, but -

dlopen(NULL, RTLD_LAZY/*Any load option u want*/) will get a handle to the binary. And it is supposed to be able to find any symbol in the binary or shared libs it has loaded. I think that is a good place to start.

nakiya