help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: constructors not called in dynamic object, Linux only.


From: Paul Pluzhnikov
Subject: Re: constructors not called in dynamic object, Linux only.
Date: 01 Feb 2005 16:54:52 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

James Kanze <kanze@none> writes:

> Does anyone know what options are necessary for static
> initializers in a dynamic object to be correctly executed under
> Linux.

Compiling with '-fPIC' and linking with '-shared' has always sufficed
for me.

> The g++ documentation for -shared has a footnote "On some
> systems, gcc -shared needs to build supplementary stub code for
> constructors to work. ...
> Presumable, Linux is one of the cases where you need some
> special option to make g++ generate these stubs

No, Linux/ELF does *not* need to generate any such stubs.
They are only needed on platforms which do not support .init/.fini
sections.

Either you are using some extremely weird (or old) Linux environment,
or there is something else going on which you didn't tell us about.

As Larry said, post a minimal test case, and do tell us what Linux,
and what versions of g++ and binutils you are using.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]