INFORMIX
Informix-ESQL/C Programmer's Manual
Chapter 13: Using Informix Libraries
Home Contents Index Master Index New Book

Compatibility of Pre-existing ESQL/C Applications with Current Library Versions

You specify the esql command-line options in Figure 13-2 to tell the esql command which version of the Informix libraries to link with the ESQL/C application. Once the esql command successfully compiles and links your application, the version of the Informix general libraries is fixed. When you install a new version of ESQL/C, you receive new copies of the Informix general libraries. Whether you need to recompile and relink your existing ESQL/C applications to run with these new copies depends on the factors that the following table describes.

Important: Static versions of Informix general libraries are available only for ESQL/C on a UNIX operating system.

Change to the Informix General LIbrary Version of the Informix General Library Need to Recompile or Relink?

New release of the Informix general libraries

Static

Thread-safe static

Only if the application needs to take advantage of a new feature in the new release

Informix general libraries in new release have a new major-version number

Shared

Thread-safe shared

Only if the application needs to take advantage of a new feature in the new release

Informix general libraries in new release have a new API-version number

Shared

Thread-safe shared

Must recompile and relink

UNIX
On UNIX, you can use the ifx_getversion utility to determine the version of an Informix library that is installed on your system. For more information, see
"Using the ifx_getversion Utility".

WIN NT/95
In Windows environments, use the following find command to find the occurrence of the string that contains the version number in the isqlt09A.dll. Note that the command needs to be issued from the %INFORMIXDIR%\bin directory.

The output of the find command is shown below:

UNIX

Using the ifx_getversion Utility

To obtain the complete version name of an Informix library, use the ifx_getversion utility. Before you run ifx_getversion, set the INFORMIXDIR environment variable to the directory in which your Informix product is installed.

The ifx_getversion utility has the following syntax.

Element Purpose Key Considerations

xx

For static libraries, xx specifies the .a file extension; for shared libraries, xx specifies the platform-specific file extension.

Additional Information: For shared libraries, the Sun platform uses the .so file extension and the Hewlett-Packard (HP) platform uses the .sl file extension.

The following example shows sample output that the ifx_getversion utility generates for the libgen Informix library:

Output of ifx_getversion depends on the version of ESQL/C software that is installed on your system.

Checking the API Version of a Library

When you invoke an ESQL/C application that is linked with shared Informix general libraries, the release number of these shared libraries must be compatible with that of the shared libraries in the $INFORMIXDIR/lib or the %INFORMIXDIR%\lib directory.

WIN NT/95
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.

UNIX
In case of an ESQL/C 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, ESQL/C does this check for you. ESQL/C 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 ESQL/C product.
Figure 13-3 shows where the API version appears in the shared library name.

ESQL/C uses an Informix function that is called checkapi() to perform this check. The checkapi() function is in the checkapi.o object file, which is contained in the $INFORMIXDIR/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, ESQL/C checks the values of special macro definitions in the executable file. When the ESQL/C 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:

Tip: The ESQL/C preprocessor automatically includes the sqlhdr.h file in all ESQL/C executable files that it generates.
If the API version of the libraries in this executable file are not compatible, ESQL/C returns a runtime error that indicates which library is not compatible. You must recompile your ESQL/C application to link the new release-version of the shared library.

If you do not use esql to link one of the shared Informix general libraries with your ESQL/C application, you must explicitly link the checkapi.o file with your application. Otherwise, ESQL/C might generate an error at link time of the form:




Informix-ESQL/C Programmer's Manual, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.