Few days ago I run into the weird problem with globally declared objects and
shared libraries.
What it comes to is that the constructor of the statically allocated object
get called twice on the same object. I had quite hard time finding out what
is going on in my real code but here is set of files producing the same
thing.
Even if I am doing something strange, something like this should not happen
(note that “testdll.so” is loaded twice, on startup and “manually” from the
“main”)
We are still running QNX 6.1 (patch A) on x86 (PIII).
This is a known bug in 6.1 that was fixed for 6.2. You’re running accross
it because you’re compiling your test executable with a dependency on
testdll.so AND dlopening the same object in the code. If you remove either
the dependency on the compile line OR the dlopen, this problem should go
away.
Few days ago I run into the weird problem with globally declared objects
and
shared libraries.
What it comes to is that the constructor of the statically allocated
object
get called twice on the same object. I had quite hard time finding out
what
is going on in my real code but here is set of files producing the same
thing.
Even if I am doing something strange, something like this should not
happen
(note that “testdll.so” is loaded twice, on startup and “manually” from
the
“main”)
We are still running QNX 6.1 (patch A) on x86 (PIII).
Thing were not so obvious in my project and it is not so easy to get rid of
the duplicate loading (my “main” code is linking against a so and my
plug-in(s) are linking against it as well). It is easy to work around the
problem anyway as long as you know what the problem is.
Since the bug is fixed whole story is obsolete anyway.
This is a known bug in 6.1 that was fixed for 6.2. You’re running accross
it because you’re compiling your test executable with a dependency on
testdll.so AND dlopening the same object in the code. If you remove
either
the dependency on the compile line OR the dlopen, this problem should go
away.
Few days ago I run into the weird problem with globally declared objects
and
shared libraries.
What it comes to is that the constructor of the statically allocated
object
get called twice on the same object. I had quite hard time finding out
what
is going on in my real code but here is set of files producing the same
thing.
Even if I am doing something strange, something like this should not
happen
(note that “testdll.so” is loaded twice, on startup and “manually” from
the
“main”)
We are still running QNX 6.1 (patch A) on x86 (PIII).