C++: dlclose doesn't unload the shared library

前端 未结 1 1015
醉梦人生
醉梦人生 2020-12-17 21:37

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

相关标签:
1条回答
  • 2020-12-17 22:21

    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.

    0 讨论(0)
提交回复
热议问题