🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3393

Re: C++ globals and shared lib, how to ?

#3393
From: Yves Dufournaud
Date: Wed, 03 Feb 1999 00:00
47 lines
2297 bytes
Casper H.S. Dik - Network Security Engineer wrote:
> 
> [[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]
> 
> Steve<_s_t_e_v_e_@maths.tcd.ie> no underscores writes:
> 
> >Yves Dufournaud <Yves.Dufournaud@imag.fr> writes:
> 
> >>I'am trying basic things using dlopen with g++-2.7.2.3 on sunos 5.5 :
> >>but when I load it with a dlopen and using RTLD_NOW
> >>constructor of global object are not called.
> 
> >Isn't this a known bug with sunos? You could always
> >find the initialisation routine and call it manually
> >I suppose.
> 
> No, this works fine in Solaris 2.x (SunOS 5.x), which is what he is using.
> You need to link with the compiler and probably with a newer version of
> gcc/g++ too.

I've followed the advice that many of you gave me : that is trying
to use a newer version of g++.

It seems that using the new version ( I've tried both g++-2.8.1 and
egcs-?)
I can't compile my code due to unresolved reference :

In this case, the unresolved reference is a global symbol which must
stay in the caller code
(the one which do the dlopen call)

I see no reason why it couldn't be done, but then how can I build the
shared object without
resolving that reference at compile time. I've tried the -Ur flag, but
without much success.
When I do that I get many unresolved reference comming from the standard
lib, and their
is no object file produced.

Cheers,

Yves

--
Yves Dufournaud Email Yves.Dufournaud at imag.fr equipe MOVI laboratoire
GRAVIR
--
Technical Details
Message-ID: <36B86AE9.3A83@imag.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36B5EA0E.2361@imag.fr> <799gho$lpt@salmon.maths.tcd.ie> <casper.918048827@nl-usenet.sun.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc89c,3b56ba1236b2e4f
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 10ba33,3b56ba1236b2e4f
X-Google-Attributes: gid10ba33,public
X-Google-Thread: 11035d,3b56ba1236b2e4f
X-Google-Attributes: gid11035d,public
From: Yves Dufournaud <Yves.Dufournaud@imag.fr>
Subject: Re: C++ globals and shared lib, how to ?
Date: 1999/02/03
Message-ID: <36B86AE9.3A83@imag.fr>
X-Deja-AN: 440209612
Content-Transfer-Encoding: 7bit
References: <36B5EA0E.2361@imag.fr> <799gho$lpt@salmon.maths.tcd.ie> <casper.918048827@nl-usenet.sun.com>
Content-Type: text/plain; charset=us-ascii
Organization: Unite de Recherche INRIA Rhone-Alpes France
Mime-Version: 1.0
Newsgroups: comp.unix.programmer,comp.unix.solaris,gnu.g++.help