Conditional compiling

The compiler supports conditional compiling directives in ST, IL, LD, and FBD languages. Conditional compiling directives condition the inclusion of a part of the program in the generated code. Conditional compiling is an easy way to manage several various configurations and options in a unique application programming.

Conditional compiling uses definitions as conditions. Below is the main syntax:






If CONDITION has been defined using #define syntax, then the "statementsYES" part is included in the code, else the "statementsNO" part is included. The "#else" statement is optional.

In ST and IL text languages, directives must be entered alone on one line line of text. In FBD language, directives must be entered as the text of network breaks. In LD language, directives must be entered on comment lines.

The condition "__DEBUG" is automatically defined when the application is compiled in DEBUG mode. This allows you to incorporate some additional statements (such as trace outputs) in your code that are not included in RELEASE mode.