Re: [AD] Alleg5 - new driver structure idea

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 07 September 2002 16:52, Bob wrote:
> There is also the issue of supporting older interfaces. What if we
> add a parameter to blit() for example? We can make a "blit2" entry in
> the driver, but then we also need to support the old "blit"
> interface.

Or supply a default "blit2" entry, only used when the driver doesn't 
provide it, which wraps around the original "blit" call.

> Finally, I'm not really sure how it'll work for the DOS port, where
> people keep complaining about large executable sizes. Will this
> system really allow us the user to pick and chose the drivers he
> wants linked in, without the #define trickery that was needed before?
> Or will this (somehow) force all of Allegro to be linked in all the
> time?

That depends :-)
The library should be set up so that, for each driver, the register 
function is called in constructor section of its .c file. The function 
which uses the driver (eg. play_midi) must appear in that same .c file 
(or rather, that same compilation unit).

That way, when the compiler sees that play_midi() is called, the 
relevant compilation unit is linked in and the drivers register 
themselves at startup. If play_midi() is not referenced, the linker 
will skip that compilation unit and the drivers won't register 
themselves => no space used.

It's an elegant solution for the most part, but enforces the 
"play_midi() must appear in the driver file" paradigm, which is not 
necessarily a good thing.

Bye for now,
- -- 
Laurence Withers,  lwithers@xxxxxxxxxx
(GnuPG 04A646EA) http://www.lwithers.demon.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9ejG0UdhclgSmRuoRAjLJAKCtUVHHi0TgTx5mdcm9IG8rmJBOQgCfe/lB
ppCHWZniyL0IThS/pme7UyM=
=9QdA
-----END PGP SIGNATURE-----



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