Re: [AD] version check in allegro_init |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Evert Glebbeek wrote:
Do we really need to make the check optional? We could just put the check into install_allegro() and if the versions don't match we can show a message using allegro_message() and return an error code.The problem is that we need to check the values of ALLEGRO_VERSION, ALLEGRO_SUB_VERSION and ALLEGRO_WIP_VERSION as defined in the header file #included by the user to the values in the headerfile used when the library was compiled. The only way to do this (as far as I know) is to pass the values as arguments to a function in the library from the user's code.
Oh, right. Oops.
Doing this using install_allegro() makes the most sense, but we can't add arguments to the function because it's part of the public API.
Well, we could bend the rules a little. As Elias suggested we could change install_allegro into a macro. For the rare cases where people take the address of install_allegro, we still define install_allegro as a function. If you call install_allegro and bypass the macro you won't get the version check, but that's okay.
Peter
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |