dlclose() doesn't work with factory function & complex static in function?
I'm making a simple plugin framework in which I'd like to be able to dlopen() a shared library (i.e. plugin), inspect and use whatever factory functions is provides and eventually dlclose() it, leaving no trace. My factory system is trivial, with a single exported function that returns a pointer to a common Base class. To check the plugin has been unloaded properly, I have a static object whose destructor sets a bool from the main program. Here's the main program: // dltest.cpp follows. Compile with g++ -std=c++0x dltest.cpp -o dltest -ldl #include <dlfcn.h> #include <iostream> using namespace