The ESQL/C preprocessor

To preprocess, compile, and link a program that contains Informix® ESQL/C statements, you must pass it through the Informix® ESQL/C preprocessor. You use the esql command to run the preprocessor on your Informix® ESQL/C source file and create an executable file. The esql command follows these steps to carry out the conversion:
  • In stage one, the Informix® ESQL/C preprocessor performs the following steps:
    • Incorporates header files into the source file when it processes all include directives ($include and EXEC SQL include statements)
    • Creates or removes compile-time definitions when it processes all define ($define and EXEC SQL define) and undef ($undef and EXEC SQL undef) directives
  • In stage two, the Informix® ESQL/C preprocessor processes any conditional compilation directives (ifdef, ifndef, else, elif, endif) and translates embedded SQL statements to Informix® ESQL/C function calls and special data structures.

    Stages 1 and 2 mirror the preprocessor and compiler stages of the C compiler. Successful completion of the preprocessing step yields a C source file (.c extension). For information about command-line options that affect the preprocessing step, see Options that affect preprocessing.

The esql command processor is installed as part of the Informix® ESQL/C product. Before you use esql, ensure that:
  • The file name of the Informix® ESQL/C source file has the .ec or the .ecp.
  • The INFORMIXDIR and PATH environment variables are set correctly.

    If the INFORMIXDIR environment variable is not set in the command window or in the Windows™ Registry, it is set internally to the location of the Informix® Client SDK dynamically linked libraries.

    If the INFORMIXDIR environment variable is not set in UNIX™, an error is returned when compiling any application.

    For information about how to set the INFORMIXDIR and PATH variables, see the Informix® Client Products Installation Guide for your operating system.

For a detailed explanation of the syntax of the esql command, see The esql command.
Important: Always link your Informix® ESQL/C program with the esql program. The lists of libraries that Informix® uses can change between releases. Linking with esql assures that your Informix® ESQL/C program links correctly with Informix® libraries.

The C code that the Informix® ESQL/C preprocessor generates might change from one release of the product to the next. Therefore, do not design Informix® ESQL/C programs that depend on how Informix® implements the functionality and features of the product in the C code that the Informix® ESQL/C preprocessor generates. Instead, develop your programs with the functionality and features of the product that this publication describes.