Subject: Re: C++ q: constructors not called for classes in shared lib ?
To: Jaromir Dolecek <>
From: Frank van der Linden <>
List: current-users
Date: 02/02/1999 14:12:00
On Tue, Feb 02, 1999 at 01:20:13PM +0100, Jaromir Dolecek wrote:
> As I'm C++ dumb, my question may sound silly or even be incorrect,
> but here it is:
> Is the constructor properly called for static classes when they
> reside in shared libs ?
> If not, is it error of our implementation or it's error of
> code, which uses such classes ?

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.

To make this work, you will need to include a .o file that takes care
of this when creating the shared library. This is done for the
"system" C++ shared libraries (i.e. libstdc++). The .o file in question
is /usr/lib/c++rt0.o.

Apparently, the KDE shared library that includes C++ code is not being
created with /usr/lib/c++rt0.o by the package. You might want to send-pr
the bug.

- Frank