Next: , Previous: , Up: Preparation   [Contents][Index]


2.3 Version Check

It is often desirable to check that the version of the library used is indeed one which fits all requirements. Even with binary compatibility, new features may have been introduced but, due to problem with the dynamic linker, an old version may actually be used. So you may want to check that the version is okay right after program startup.

gsasl_check_version

Function: const char * gsasl_check_version (const char * req_version)

req_version: version string to compare with, or NULL.

Check GNU SASL Library version.

See GSASL_VERSION for a suitable req_version string.

This function is one of few in the library that can be used without a successful call to gsasl_init() .

Return value: Check that the version of the library is at minimum the one given as a string in req_version and return the actual version string of the library; return NULL if the condition is not met. If NULL is passed to this function no check is done and only the version string is returned.

The normal way to use the function is to put something similar to the following early in your main:

  if (!gsasl_check_version (GSASL_VERSION))
    {
      printf ("gsasl_check_version failed:\n"
              "Header file incompatible with shared library.\n");
      exit(1);
    }