Re: [AD] Bloat Issues

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


Burton Radons <loth@xxxxxxxxxx> writes:
> Actually, _midi_constructor just sets two statics and returns.  That is
> not a good enough reason or a strong enough tie.  The two statics should
> be moved into allegro.c and set directly from there.
> 
> The other constructor is for initialising datafile types.  If
> allegro_init can call it directly, then the constructor attribute use
> makes Allegro behave differently on different systems.  It should be
> turned to the simple call and the last of those dinosaur constructors
> will be gone.

You are misunderstanding the whole point of why those constructors exist. 
They are to _improve_ executable size, not make it worse! Without them, 
some modules have to issue calls to other modules, eg. install_sound() 
calls midi_init(), which means that every time you use any sound code, it 
has to link in all the MIDI code as well, even if you never call any MIDI 
functions. The constructors are used to set up an indirect pointer to 
those functions instead, so that the code only gets linked if it is 
actually called. This is a Good Thing, and has no adverse effects at all.

Regarding the general issue of executable size, yes, it's bad. The basic 
design of Allegro isn't very good for linker performance. With a bit of 
care we can avoid any really stupid things, though, like dragging in all 
the sound and graphics stuff if none of it is used, and SET did quite a 
bit of work a while back to make sure this works nicely (like adding 
those constructor functions). Since then it's very likely that some other 
interdependencies have crept back in so that more redundant code is being 
linked, and I'd be very happy for anyone else who wants to look at this 
to find out why and make sure those dependencies go away again. It's a 
laborious job (making lots of test programs and looking at nm output for 
all the different modules) and I don't care to do it myself, but I'm 
always happy to accept patches for such things.

A much easier solution, though, is to upgrade to an OS that supports 
shared libraries :-)



-- 
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."



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