id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8414,flyweights causes weird library initialization error,charles quarra ,Joaquín M López Muñoz," the bug is reproduced with the following test case: g++ main.cpp -o xmain -ldl main.cpp: #include #include int main() { std::cout << ""load: "" << std::endl; void *foo = dlopen(""./libpluginTest.so"", RTLD_NOW); std::cout << ""load: library loaded ""<< foo << std::endl; if (dlclose(foo) < 0) { std::cout << ""load: library close failed "" << std::endl; return 1; } std::cout << ""load: library closed "" << std::endl; return 0; } --- g++ -I/path/to/boost/includes -fPIC -shared -rdynamic test_plugin.cpp -o libpluginTest.so -L/path/to/boost/libs -lrt test_plugin.cpp: #include //#include #include typedef boost::flyweight< std::string > SymbolName_t; SymbolName_t getEmptyStringSymbol() { SymbolName_t empty(""""); return empty; } void __attribute__ ((constructor)) library_init() { std::cout << ""Library constructor: "" << std::endl; } void __attribute__ ((destructor)) library_fini() { std::cout << ""Library destructor:"" << std::endl; } this program outputs the following: load: Library constructor: address of static cbContainer is: load: library loaded 0x1226030 load: library closed Library destructor: as this shows, the library destructor is called at program termination, and NOT before dlclose returns, which is the expected behavior. If we comment the function 'getEmptyStringSymbol', the resulting output is: load: Library constructor: address of static cbContainer is: load: library loaded 0x1b0b030 Library destructor: load: library closed which is the expected behavior this bug has been reproduced on the following compilers: g++-4.6 (Ubuntu/Linaro 4.6.3-10ubuntu1) 4.6.3 20120918 (prerelease) g++-4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 ",Bugs,closed,To Be Determined,flyweight,Boost 1.53.0,Showstopper,invalid,,