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