Check the API version of a library

When you invoke the application that is linked with shared HCL OneDB™ general libraries, the release number of these shared libraries must be compatible with that of the shared libraries in the $ONEDB_HOME/lib or the %ONEDB_HOME%\lib directory.

In a Windows™ environment, a developer can easily verify the name of the shared library DLL, namely isqltnnx.dll, where nn stand for the version number, and x stand for the API version.

For the application on UNIX™, however, given that the linked libraries get symbolic names, it is not easy to find the version number of the linked library. Therefore, does this check for you. performs an internal check between the API version of the library that the application uses and the API version of the library that is installed as part of your product. Format of the HCL OneDB shared-library name shows where the API version appears in the shared library name.

uses the HCL OneDB function that is called checkapi() to perform this check. The checkapi() function is in the checkapi.o object file, which is contained in the $ONEDB_HOME/lib/esql directory. The esql command automatically links this checkapi.o object file with every executable that it creates.

To determine the API version of the library that the application uses, checks the values of special macro definitions in the executable file. When the preprocessor processes a source file, it copies the macro definitions from the sqlhdr.h header file into the C source file (.c) that it generates. The following example shows sample values for these macros:
#define CLIENT_GEN_VER                  710
#define CLIENT_OS_VER                  710
#define CLIENT_SQLI_VER                  710
#define CLIENT_GLS_VER                  710
Tip: The preprocessor automatically includes the sqlhdr.h file in all executable files that it generates.

If the API version of the libraries in this executable file is not compatible, returns a runtime error that indicates which library is not compatible. You must recompile your application to link the new release version of the shared library.

If you do not use esql to link one of the shared HCL OneDB general libraries with your application, you must explicitly link the checkapi.o file with your application. Otherwise, might generate an error at link time of the form:
undefined ifx_checkAPI()