__attribute__((constructor))

John Levon moz@compsoc.man.ac.uk
Tue Jun 26 16:46:00 GMT 2001


On Tue, Jun 26, 2001 at 08:16:11PM -0300, Alexandre Oliva wrote:

> On Jun 25, 2001, John Levon <moz@compsoc.man.ac.uk> wrote:
> 
> > Is attribute constructor/destructor supposed to work for libraries
> > (particularly a static .a library) ?
> 
> If you use GCC to link the static library into the program, yes.  But
> make sure the object file in which the constructor/destructor is
> defined is actually linked in, i.e., make sure you bring at least one
> symbol from it.

OK, thanks. I appear to be doing this as I am using -finstrument-functions
in  the program and __cyg_profile_func_enter() in the library. 
Will this do it (is it a weak symbol generated ?)

thanks
john

-- 
"Euler's equation contains the five most important numbers in mathematics."



More information about the Gcc-help mailing list