Subject: Re: C++ Static Constructors and dlopen()'d Shared Libraries
To: Dave Huang <email@example.com>
From: Jay Painter <firstname.lastname@example.org>
Date: 03/07/2000 17:08:32
> I haven't looked at your test program, but I've seen this problem
> before... when creating your C++ shared library, try adding c++rt0.o to
> the list of object files on the link line.
It's there, and in the right place. The compiler's built-in specs
properly call collect2 with /usr/lib/c++rt0.o (you can see this when you
link with g++ -v shared). When I was linking with GCC 2.95.2 which I
built, I modified the makefile to call collect2 directly, and inlcuded
c++rt0.o. I'd guess the NetBSD 1.4.1 copy of c++rt0.o was compiled with
EGCS-1.1.1, and the object file format from that compiler is incompatible
with GCC 2.95.2's. Even if that's the case, there's still the problem of
the destructors not being called, which seems like a bug.