RTLD_LOCAL and dynamic_cast on Linux
We have a plugin that is constructed of a few shared libraries in our application that we need to update while the application is running. For performance reasons we load and start using the new plugin before unloading the old plugin and only when all threads are done using the old plugin we unload it. Since the libraries of the new plugin and the old plugin have the same symbols in them we dlopen() with RTLD_LOCAL . If we don't the new plugin call from internal functions by accident to symbols from the old plugin. One library of the plugin does dynamic_cast() to an object that was created by