https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97908
--- Comment #4 from Jan Engelhardt <jengelh at inai dot de> --- >don't dlclose a library when you are using anything from it. That's easier said then done when using C++, as (inline) functions and static objects can potentially be instantiated in any object file. A shared library using typeid(T) could be getting the typeinfo either from a possible copy in the main program, or from the copy inside any loaded shared library.