This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60731] [4.7/4.8/4.9 Regression] dynamic library not getting reinitialized on multiple calls to dlopen()
- From: "neleai at seznam dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Apr 2014 09:09:21 +0000
- Subject: [Bug c++/60731] [4.7/4.8/4.9 Regression] dynamic library not getting reinitialized on multiple calls to dlopen()
- Auto-submitted: auto-generated
- References: <bug-60731-4 at http dot gcc dot gnu dot org/bugzilla/>
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.