Copyright (C) 2000-2012 |
GNU Info (mikmod.info)Library VersionLibrary Version =============== If your program is dynamically linked with the MikMod library, you should check which version of the library you're working with. To do this, the library defines a few constants and a function to help you determine if the current library is adequate for your needs or if it has to be upgraded. When your program includes `mikmod.h', the following constants are defined: * `LIBMIKMOD_VERSION_MAJOR' is equal to the major version number of the library. * `LIBMIKMOD_VERSION_MINOR' is equal to the minor version number of the library. * `LIBMIKMOD_REVISION' is equal to the revision number of the library. * `LIBMIKMOD_VERSION' is the sum of `LIBMIKMOD_VERSION_MAJOR' shifted 16 times, `LIBMIKMOD_VERSION_MINOR' shifted 8 times, and `LIBMIKMOD_REVISION'. So your program can tell with which version of the library it has been compiled this way: printf("Compiled with MikMod Sound Library version %ld.%ld.%ld\n", LIBMIKMOD_VERSION_MAJOR, LIBMIKMOD_VERSION_MINOR, LIBMIKMOD_REVISION); The library defines the function `MikMod_GetVersion' which returns the value of LIBMIKMOD_VERSION for the library. If this value is greater than or equal to the value of LIBMIKMOD_VERSION for your program, your program will work; otherwise, you'll have to inform the user that he has to upgrade the library: { long engineversion = MikMod_GetVersion(); if (engineversion < LIBMIKMOD_VERSION) { printf("MikMod library version (%ld.%ld.%ld) is too old.\n", (engineversion >> 16) & 255, (engineversion >> 8) & 255, (engineversion) & 255); printf("This programs requires at least version %ld.%ld.%ld\n", LIBMIKMOD_VERSION_MAJOR, LIBMIKMOD_VERSION_MINOR, LIBMIKMOD_REVISION); puts("Please upgrade your MikMod library."); exit(1); } } automatically generated by info2www version 1.2.2.9 |