ESQL/C preprocessor directives

You can use the following capabilities of the preprocessor when you write code:
  • The include directive expands 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 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 preprocessor works in two stages. In stage 1, it acts as a preprocessor for the code. In stage 2, it converts all of the embedded SQL code to C code.

In stage 1, the preprocessor incorporates other files in the source file by processing all include directives ($include and EXEC SQL include statements). Also in stage 1, 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 preprocessor directives in more detail.