Subject: C++ Static Constructors and dlopen()'d Shared Libraries
To: None <tech-toolchain@netbsd.org>
From: Jay Painter <jpaint@real.com>
List: tech-toolchain
Date: 03/07/2000 14:49:16
I'm having problems getting static (global) constructors and destructors
to work when I dlopen() a C++ shared library on NetBSD 1.4.1 i386.
When I use the compiler which shipped with NetBSD 1.4.1
(egcs-1.1.1), static constructors work on dlopen(); however, the static
destructors do not get called on dlclose(). Unfortunately, I cannot use
the EGCS compiler, and need to use GCC 2.95.2. Compiling and linking the
same way, I cannot get the constructors to work at all with this compiler.
I've written a simple test program which shows this behavior. It can be
found at ftp://sculpin.com/jpaint/test-plugin.tar.gz.
Also, I can't get this to work at all on OpenBSD 2.6, if anybody happens
to work on both here...
Regards,
Jay Painter