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

2.3 Version Check

It is often desirable to check that the version of ‘Libidn’ 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 is actually used. So you may want to check that the version is okay right after program startup.


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

req_version: Required version number, or NULL.

Check that the version of the library is at minimum the requested one and return the version string; return NULL if the condition is not satisfied. If a NULL is passed to this function, no check is done, but the version string is simply returned.

See STRINGPREP_VERSION for a suitable req_version string.

Return value: Version string of run-time library, or NULL if the run-time library does not meet the required version number.

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

  if (!stringprep_check_version (STRINGPREP_VERSION))
      printf ("stringprep_check_version() failed:\n"
              "Header file incompatible with shared library.\n");