ESQL/C preprocessor directives

You can use the following capabilities of the Informix® ESQL/C preprocessor when you write Informix® ESQL/C code:
  • The include directive expands Informix® ESQL/C include files within your program.
  • The define and undef directives create compile-time definitions.
  • The ifdef, ifndef, else, elif, and endif directives specify conditional compilation.
As with embedded SQL statements, you can use either of two formats for Informix® ESQL/C preprocessor directives:
  • The EXEC SQL keywords:
    EXEC SQL preprocessor_directive;

    The EXEC SQL keywords conform to ANSI standards.

  • The dollar sign ($) notation:
    $preprocessor_directive;

In either of these formats, replace preprocessor_directive with one of the valid preprocessor directives that the following sections describe. You must terminate these directives with a semicolon (;).

The Informix® ESQL/C preprocessor works in two stages. In stage 1, it acts as a preprocessor for the Informix® ESQL/C code. In stage 2, it converts all of the embedded SQL code to C code.

In stage 1, the Informix® ESQL/C preprocessor incorporates other files in the source file by processing all include directives ($include and EXEC SQL include statements). Also in stage 1, Informix® ESQL/C creates or removes compile-time definitions by processing all define ($define and EXEC SQL define) and undef ($undef and EXEC SQL undef) directives.

The remainder of this section describes each of the Informix® ESQL/C preprocessor directives in more detail.