Article View: comp.unix.programmer
Article #3385Re: C++ globals and shared lib, how to ?
From: Yves Dufournaud
Date: Thu, 04 Feb 1999 00:00
Date: Thu, 04 Feb 1999 00:00
48 lines
2214 bytes
2214 bytes
Yves Dufournaud wrote: > > 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++. OK, I've managed to do what I wanted : You are right there is a bug in g++-2.7.x and that why I got this behavior. Now it compiles fine using g++-2.8.1 (I haven't try egcs). The problem I was having with other globals not resolved, were solved using the -Ur flag for compilation in conjunction with RTLD_GLOBAL in the dlopen function. So it works fine now, thank you for your help. Cheers, Yves. -- Yves Dufournaud Email Yves.Dufournaud at imag.fr equipe MOVI laboratoire GRAVIR --
Technical Details
Message-ID:
<36B9AD45.2A5E@imag.fr>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36B5EA0E.2361@imag.fr> <799gho$lpt@salmon.maths.tcd.ie> <casper.918048827@nl-usenet.sun.com> <36B86AE9.3A83@imag.fr>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/04 Message-ID: <36B9AD45.2A5E@imag.fr> X-Deja-AN: 440593724 Content-Transfer-Encoding: 7bit References: <36B5EA0E.2361@imag.fr> <799gho$lpt@salmon.maths.tcd.ie> <casper.918048827@nl-usenet.sun.com> <36B86AE9.3A83@imag.fr> 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