Version Information

Version Information — Variables and functions to check the MLib version

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <mlib.h>

mconstchars         mlib_check_version                  (muint required_major,
                                                         muint required_minor,
                                                         muint required_micro);
extern              const muint mlib_major_version;
extern              const muint mlib_minor_version;
extern              const muint mlib_micro_version;
extern              const muint mlib_interface_age;
extern              const muint mlib_binary_age;
#define             MLIB_CHECK_VERSION                  (major,
                                                         minor,
                                                         micro)

Description

MLib provides version information, primarily useful in configure checks for builds that have a configure script. Applications will not typically use the features described here.

Details

mlib_check_version ()

mconstchars         mlib_check_version                  (muint required_major,
                                                         muint required_minor,
                                                         muint required_micro);

stability: Unstable

Checks that the MLib library in use is compatible with the given version. Generally you would pass in the constants MLIB_MAJOR_VERSION, MLIB_MINOR_VERSION, MLIB_MICRO_VERSION as the three arguments to this function; that produces a check that the library in use is compatible with the version of MLib the application or module was compiled against.

Compatibility is defined by two things: first the version of the running library is newer than the version required_major.required_minor.required_micro. Second the running library must be binary compatible with the version required_major.required_minor.required_micro (same major version.)

required_major :

the required major version.

required_minor :

the required minor version.

required_micro :

the required micro version.

Returns :

NULL if the MLib library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by MLib and must not be modified or freed.

Example 8. Using a mlib_check_version().


#include <mlib.h>
#include <mlib/mprintf.h>


    int
    m_main ( argc, argv )
{
    m_main_init ( argc, argv );

    m_printf ( "\n mlib_check_version: %s ", ifelse ( mlib_check_version ( 0,0,0 ) == NULL,
                                                      "is compatible",
                                                      mlib_check_version ( 0,0,0 ) ) );

    return MCORRECT;
}

  

Since 0.0.1


mlib_major_version

extern const muint mlib_major_version;

The major version number of the MLib library. (e.g. in MLib version 1.2.5 this is 1.)

This variable is in the library, so represents the MLib library you have linked against. Contrast with the MLIB_MAJOR_VERSION macro, which represents the major version of the MLib headers you have included.


mlib_minor_version

extern const muint mlib_minor_version;

The minor version number of the MLib library. (e.g. in MLib version 1.2.5 this is 2.)

This variable is in the library, so represents the MLib library you have linked against. Contrast with the MLIB_MINOR_VERSION macro, which represents the minor version of the MLib headers you have included.


mlib_micro_version

extern const muint mlib_micro_version;

The micro version number of the MLib library. (e.g. in MLib version 1.2.5 this is 5.)

This variable is in the library, so represents the MLib library you have linked against. Contrast with the MLIB_MICRO_VERSION macro, which represents the micro version of the MLib headers you have included.


mlib_interface_age

extern const muint mlib_interface_age;

This is the interface age passed to libtool. If libtool means nothing to you, don't worry about it. ;-)


mlib_binary_age

extern const muint mlib_binary_age;

This is the binary age passed to libtool. If libtool means nothing to you, don't worry about it. ;-)


MLIB_CHECK_VERSION()

#define             MLIB_CHECK_VERSION(major,minor,micro)

stability: Unstable

Checks the version of the MLib library.

major :

the major version number.

minor :

the minor version number.

micro :

the micro version number.

Returns :

TRUE if the version of the MLib header files is the same as or newer than the passed-in version.

Example 9. Checking the version of the MLib library

    if (!MLIB_CHECK_VERSION (1, 2, 0))
    m_error ("MLib version 1.2.0 or above is needed");