http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60731
Ondrej Bilka <neleai at seznam dot cz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |neleai at seznam dot cz --- Comment #9 from Ondrej Bilka <neleai at seznam dot cz> --- I started to looking what STB_UNIQUE purpose is so I have several questions. First does suggestion below really work? http://gcc.gnu.org/ml/gcc-help/2011-05/msg00450.html Say you have foo.so with unique symbol foo and function bar *getfoo() { return (void *) &foo; } which gets loaded and unloaded like void *h = dlopen("foo.so",RTLD_NOW); bar *p1 = dlsym(h,"getfoo")(); dlclose(h); foo->baz(); h = dlopen("foo.so",RTLD_NOW); bar *p2 = dlsym(h,"getfoo")(); dlclose(h); Are p1 and p2 supposed to point to same object? Also is foo->baz(); legal or not? If its so we cannot call destructors. There could be fix to add zombie state where we call destructors but not free memory so we can reinitialize object at same address but I need to know that calling destructor is always intended behaviour.