Next: , Up: General Library Functions   [Index]


8.1 Library Version Handling

Different releases of the GNU MPRIA library are distinguished by an authoritative version triplet of nonnegative integer constants defined as macro constants. Utilities are implemented to efficiently check against, to numerically pack or to stringify this triplet; packed variants of the triplet are also defined as macro constants.

Macro: MPRIA_VERSION_MAJOR
Macro: MPRIA_VERSION_MINOR
Macro: MPRIA_VERSION_MICRO

The authoritative version triplet, respectively, as nonnegative integer constants: the major version number, the minor version number (or revision number), the micro version number (or major patch level).

Function: void mpria_libversion_get_numbers (int * major, int * minor,
int * micro)

Retrieve the major, minor and micro version numbers of the MPRIA library against which the application is currently linked. The NULL pointer is accepted as argument.

Function: int mpria_libversion_check_numbers (int major, int minor, int micro)

Check the compatibility of the arbitrary major, minor and micro version numbers with their counterpart from the MPRIA library against which the application is currently linked. The returned response is as follows:

This function performs no action apart from checking and responding, in particular it does not cause the application to abort or to show up any kind of messages (it may be enwrapped within a if else statement to do so).

Macro: int mpria_libversion_check (void)

Check the compatibility of the version triplet of the MPRIA library with which an application was compiled with the version triplet of the MPRIA library against which the application is currently linked. This is a convenient wrapping macro that passes the authoritative macro version numbers to the function mpria_libversion_check_numbers, as such it acts similarly. The most common cause for an incompatibility or a weak compatibility is that an application was compiled against one version of the MPRIA library while it is dynamically linked against a different one, what might be due to a misconfiguration, a downgrading or an upgrading. A typical usage may look like:

/* Check version of libmpria */
if (!(mpria_libversion_check ()))
{
  fprintf (stderr,"version miss-compatibility\n");
  fflush (stderr);
  abort ();
}
Macro: MPRIA_VERSION_EXTRA

The extra version string suffix, only meant for development purposes. For production releases, alpha and stable ones, it must be reset to the empty string "".

Macro: MPRIA_VERSION_NUMBER_PACK (Major, Minor, Micro)
Macro: MPRIA_VERSION_STRING_PACK (Major, Minor, Micro, StrExtra)

Compact, respectively stringify, the arbitrary version triplet [Major, Minor, Micro] into a single number, resp. into a null-terminated string to which is appended the arbitrary extra version string suffix StrExtra.

Macro: MPRIA_VERSION_NUMBER
Macro: MPRIA_VERSION_STRING

The non-authoritative version number, respectively string, obtained by passing the authoritative version triplet to MPRIA_VERSION_NUMBER_PACK, resp. to MPRIA_VERSION_STRING_PACK with MPRIA_VERSION_EXTRA as fourth argument.

Function: int mpria_libversion_get_number (void)
Function: const char * mpria_libversion_get_string (void)

Retrieve the non-authoritative version number and string, respectively, of the MPRIA library against which the application is currently linked.

Macro: const char * mpria_libversion
Macro: const char * mpria_version

The version string of the MPRIA library against which the application is currently linked. While mpria_libversion is a convenient macro that wraps mpria_libversion_get_string, mpria_version is defined as synonymous of mpria_libversion with respect to the GNU MP naming scheme.


Next: , Up: General Library Functions   [Index]