Apparently, On Wed, Dec 19, 2001 at 09:46:46PM +0100,
Bernd Walter said words to the effect of;
> On Wed, Dec 19, 2001 at 08:06:20PM +0100, Maxime Henrion wrote:
> > Bernd Walter wrote:
> > > How can I add initalisation code to a library without needing to
> > > call a function in the using application?
> > > What I saw is that libc does something like this but havn't found
> > > the starting point of this.
> >
> > There are two special functions for that : _init() which will be called
> > when the object is loaded, and _fini() which will be called when it is
> > released.
>
> I can see that symbol defined in libc.so.5 but no reference in the libc
> source code.
> All I see are several *_init functions.
> Are they all called from within an autocreated _init function?
> If yes in which order?
The _init and _fini functions call global constructors and destructors
(in c++). There's a gcc extension for making a constructor in C, put
__attribute__((constructor)) in the prototype. The dynamic linker
will call them when it loads the library.
I don't know if the order that they're called in is defined or not.
>
> --
> B.Walter COSMO-Project http://www.cosmo-project.de
> [EMAIL PROTECTED] Usergroup [EMAIL PROTECTED]
>
>
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message