Date: Sun, 18 Apr 1999 09:42:54 -0700 (PDT) From: John Polstra <jdp@polstra.com> To: bright@rush.net Cc: hackers@freebsd.org Subject: Re: __attribute__ ((constructor)) functions & shared libs Message-ID: <199904181642.JAA20431@vashon.polstra.com> In-Reply-To: <Pine.BSF.3.96.990418050442.11384D-100000@cygnus.rush.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.BSF.3.96.990418050442.11384D-100000@cygnus.rush.net>, Alfred Perlstein <bright@rush.net> wrote: > I'm no compiler/linker expert, but when i wanted to do this sort of > thing, what i did was create my shared objects with functions > void _init(void) > and > void _fini(void) > > if you link the .so with -nostdlib then the init and fini functions > will be called when the shared object is linked in. It's better to use the attributes as Jacques did. The _init() and _fini() functions, like almost all functions whose names begin with "_", are private to the implementation. That is, they are for the use of the runtime system. Applications aren't allowed to override them. We probably shouldn't even mention them in the documentation. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-interest is the aphrodisiac of belief." -- James V. DeLong To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904181642.JAA20431>