Re: [AD] version check in al_init

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




On Tue, Mar 2, 2010 at 11:09 AM, Peter Wang <novalazy@xxxxxxxxxxxxxxxxx> wrote:
>
> It's hard to say. Everyone using the 4.9.x branch can be affected, and once
> we are on 5.1.x many will have the incompatible 5.0.x libraries around.

You have to try pretty hard to link with addons that don't match the
core library.

Well, before I started using only shared linking I even managed to include multiple different static versions of A4 in my .exe once :P But I agree, I don't see how you would manage wrong addons except manually listing the wrong ones in your build system.
 
5.1.x libraries won't be confused with 5.0.x libraries because they will
be named differently.


What I was thinking of is, I link with the 5.0 libraries, but #include <allegro5/allegro.h> pulls in the 5.1 headers. Nothing in the headers concerns the linker as far as I know so now e.g. swapped function parameters between those versions will lead to seemingly weird bugs.
 
> The
> patch doesn't actually fix my problem since 4.9.17 doesn't have the check,
> so I'm thinking maybe the check is better put into the macro itself?
> Something like:
>
> #define al_init() al_is_version_ok(ALLEGRO_VERSION) ? al_install_system() :
> false

Maybe ask the user to pass ALLEGRO_VERSION to al_install_system() as a
parameter, then

   #define al_init()   al_install_system(ALLEGRO_VERSION, atexit)


I like it - I'll add the parameter.

And in fact, from there on addons could simply compare their own version to al_get_allegro_version() to know when they are in a messed up build at runtime...


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