MLib Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#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)
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.
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.)
|
the required major version. |
|
the required minor version. |
|
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 #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
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.
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.
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.
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. ;-)
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. ;-)
#define MLIB_CHECK_VERSION(major,minor,micro)
stability
: Unstable
Checks the version of the MLib library.
|
the major version number. |
|
the minor version number. |
|
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"); |