http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60731
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Ondrej Bilka from comment #9) > First does suggestion below really work? > http://gcc.gnu.org/ml/gcc-help/2011-05/msg00450.html I don't see why it wouldn't. > 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. I don't think a program can reasonably rely on either of these. > 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. That sounds fine to me.