Preprocessor Directives

InstallShield 2014 » InstallScript Language Reference

Preprocessor directives are instructions to the InstallScript compiler that are executed as the script is compiled. Preprocessor directives can instruct the compiler to include other source files in the compilation, to define constants, to include or exclude statements based on compile-time conditions, and to display a user-defined error message. Although InstallScript directives are similar to directives in the C language, they are not exactly alike.

Preprocessor directives begin with a pound sign (#) and can be inserted anywhere in a script. Each directive must appear on a line by itself and must not be terminated with a semicolon.

Using Preprocessor Directives

Use the following guidelines when using preprocessor directives in your script. A preprocessor directive meets the following conditions:

It does not end with a semicolon.
It cannot line wrap.
It must be less than 250 characters in length.

Note: The expressions used in conditional directives can include constants that have been defined with the #define directive. They cannot include variables.

Supported Boolean Operators

The following Boolean operators are supported in #if, #ifdef, #ifndef, and #elif statements:

Logical OR ( || )
Logical AND ( && )
Relational ( =, !=, >, >=, <, <= )
InstallScript-Supported Preprocessor Directives

InstallScript supports the following preprocessor directives:

Preprocessor Directives

Preprocessor Directive

Description

#define

Creates a symbolic constant.

#elif

Combines #else and #if into one statement.

#else

Indicates alternatives if the test fails.

#endif

Ends a preprocessor conditional directive (#if, #ifdef, #ifndef).

#error

Displays a user-defined error message.

#if

Compiles if the conditional statement is true.

#ifdef

Compiles if a numeric constant is defined.

#ifndef

Compiles if a numeric constant is not defined.

#include

Includes the contents of another file.

#undef

Undefines a constant that was defined previously with #define.

#warning

Display a compiler warning and a user-defined error message.

See Also