I have a shared library loaded using dlopen
(with the flags RTLD_NOW | RTLD_GLOBAL
).
If this library is using functions from the main program, the
The function dlclose()
decrements the reference count on the dynamic library handle. If the reference count drops to zero and no other loaded libraries use symbols in it, then the dynamic library is unloaded.
Also the RTLD_NODELETE
(upon dlopen
) makes dlclose
not to unload the library.
Since you have not used RTLD_NODELETE
, most probable is that a loaded library uses a symbol due to the RTLD_GLOBAL
.