Subject: Re: C++ q: constructors not called for classes in shared lib ?
To: Jaromir Dolecek <jdolecek@per4mance.cz>
From: Todd Vierling <tv@pobox.com>
List: current-users
Date: 02/02/1999 12:41:03
On Tue, 2 Feb 1999, Jaromir Dolecek wrote:

: > For NetBSD ports that use a.out, global constructors are not automagically
: > initialized when using a shared library made out of C++ code. This
: > is because the appropriate calls plus a .ini section that contains
: > them are not present.
: 
: Well, it's not present because it's not possible or just because
: nobody added them (the latter is quite unlikely, I guess) ?

No, it's because it is extra code that has to be added to the library, and
there's no way around that.  On ELF systems, the equivalent to c++rt0.o is
crtbegin.o and crtend.o (linked separately at the beginning and end of the
object file list respectively), and Solaris needs just these in order to do
the same.  IIRC, you need these on Loonux as wel.

: Is there any (semi-)automatic way how to find out if it's needed or not ?

If you have a C++ shared library, `you do.' The only place the NetBSD source
tree needs it is src/gnu/lib/libstdc++/Makefile.

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)