libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _init in shared libraries?


From: Gary V . Vaughan
Subject: Re: _init in shared libraries?
Date: Fri, 9 Mar 2001 22:29:55 +0000

Hi Bruce,

On Friday 09 March 2001  5:15 pm, Peter Eisentraut wrote:
> Bruce Korb writes:
> > Is there supposed to be a way to tell GCC/collect2/ld to
> > let me supply my own _init and _fini routines?
>
> ld -init NAME -fini NAME
>
> > Or, am I required to have a pre-determined external name that I must
> > reference?  If so, what is the point of _init? *sigh*.
>
> Actually, if you are using GCC then you probably should use
> __attribute__((constructor)) and __attribute__((destructor)).  Those might
> even work on non-ELF system.
>
> I think what you were trying to do (i.e., supplying own _init) once worked
> with stock GCC, but somehow it doesn't anymore.

Different compilers implement different magic symbols for dlopen/dlclose 
invocation.  Rather than sacrifice portability to use any particular 
compiler's magic, you should probably define your own system (don't forget 
that symbols beginning with `_' are reserved for the compiler) which will 
work everywhere.

Cheers,
        Gary.
-- 
  ___              _   ___   __              _         mailto: address@hidden
 / __|__ _ _ ___ _| | / / | / /_ _ _  _ __ _| |_  __ _ ___       address@hidden
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
 \___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page:  /___/                      /___/                  gpg public key:
http://www.oranda.demon.co.uk           http://www.oranda.demon.co.uk/key.asc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]