Return to BSD News archive
Newsgroups: comp.unix.bsd.freebsd.misc Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!rill.news.pipex.net!pipex!oleane!jussieu.fr!fdn.fr!r2d2.fdn.org!sphynx.fdn.fr!causse From: causse@sphynx.fdn.fr (Philippe Causse) Subject: Re: ELF? X-Newsreader: TIN [version 1.2 PL2] Organization: individual - paris - france Message-ID: <E9CKMz.H7@sphynx.fdn.fr> References: <cmott-2004971630470001@192.168.0.5> <5jooj9$9c8@uriah.heep.sax.de> <33609855.6725@desy.de> <29577CEB029DEE7D.15EB282B5ACE579C.9F4A01791A26A597@library-proxy.airnews.net> <3363BCCC.3DF5@desy.de> <87hggsm9d8.fsf@altair.franken.de> <y7z3esb5v7l.fsf@hzsbc259.nl.lucent.com> Date: Mon, 28 Apr 1997 12:13:47 GMT Lines: 42 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:39860 Peter Mutsaers (plm@lucent.com) wrote: [...] : But I wonder: was Olaf Manczak right that the current format doesn't : allow for constructors/destructors to be called in dynamically loaded : libraries? If that is true then indeed he has a very good point that : speaks for switching to ELF ASAP. Actually John Polstra gave me some answer about C++ shared libs some time ago: if you use the makefile templates that come in /usr/share/mk you just have to add CPLUSPLUSLIB = yes somewhere in your makefile to get static objects constructed properly! The makefile would look like: ------- # -*- Makefile -*- LIB = name-of-lib SRCS = list-of-sources SHLIB_MAJOR = major-version-number SHLIB_MINOR = minor-version-number CPLUSPLUSLIB = yes .include <bsd.lib.mk> # EOF ---------------------- This magic incantation does the job :-) Objects are initialized when dlopen() is called on the library (or shared object). But anyway, constructed static objects are no good practice in a library (IMHO), avoid them if you can! : Since 3.0 is a new major release anyway, it would be a good time. Sure! : -- : Peter Mutsaers Lucent Technologies, Network Systems : plm@lucent.com Huizen, the Netherlands -- ------------------------------------------------------------------- P. Causse http://www.fdn.fr/~pcausse 4.4BSD/X11R6/Motif-2.0/C++ mailto:causse@sphynx.fdn.fr (UUCP)