I\'m using dlopen to load dynamically generated code. The program calls the compiler on the code and generates a .so file which is then loaded by the program to extend itsel
Most probly dlclose
failed to unload the library. This usually happens when it contains GNU_UNIQUE symbols (which tend to sneak in if you link with static libstdc++). This can be verified via
$ readelf -sW --dyn-syms path/to/libxyz.so | grep '\bUNIQUE\b'
...
3808: 0000000000302e78 8 OBJECT UNIQUE DEFAULT 27 _ZNSt8messagesIcE2idE@@GLIBCXX_3.4
To fix this, you can try one of the following:
-fvisibility=hidden
and __attribute__((visibility("default")))
to hide unique symbols-Wl,--version-script
to achieve the same--disable-gnu-unique-object
(see discussion in GCC list)