RE: [AD] A small bugfix in allegro_exit

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] A small bugfix in allegro_exit

> > Speaking of which, does anyone know the rationale to use
> > constructor routines with GCC ? It means stuff is called before
> > allegro_init is called, which is not very friendly.
>
> To reduce the size of statically linked programs by not pulling in
> unused modules.

I don't see why that would do that.
Say I have a part of the library that computes foos, and it needs to
be initialized by init_foo();
Then, I have the choice to call init_foo() myself, or in allegro_init
directly, or set it as a constructor routine. If I don't use the foo
stuff, then the only case where it's not referenced is the case where
I have to call init_foo myself, and don't do it (because I don't need
it). If init_foo() is setup as a constructor routine, then the foo
stuff *is* referenced even if I don't use it. Or, does this mean that
constructor routines are viewed by GCC as "weak" references that do
not imply that stuff referenced by this routine must be brought in
the link ? If so, then it means the constructor routine will not be
called if no other foo stuff is called (or it would use stuff which
was omitted in the link), thus changing the semantics of the program.
What if init_foo was:

void init_foo() {exit(0);}

(please wave away the fact that I'm calling exit before main :))

> There's a --disable-constructors or something like that.  I don't know
> if anyone has tested it recently.

I know, though I haven't tried it myself, though I was considering
trying it if more leaks were showing up.

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/