Conditional compilation

Top  Previous  Next

User interface > Translation > Preprocessing > Conditional compilation

 

Delphi2C# uses a preprocessor (pretranslator), which prepares the source text so that directives for the conditional compilation are evaluated and removed.

Conditional expressions like

 

{$IF CompilerVersion >= 17.0}

 

 

are evaluated too, but there are some limitations. Only integer values are evaluated and only operators, which also exist in C#. Sizeof-expressions like tho following are evaluated too

 

{$IF SizeOf(Extended) >= 10} 

  {$DEFINE EXTENDEDHAS10BYTES}

{$ENDIF}

 

The size is taken from the type-map.

 

If there is an expression, which cannot be evaluated, a warning is written into the code:

 

// pre-processor can't evaluate ...

 

The source code has to be corrected by hand then.

 

 

Include directives are executed too.

 

{$I filename}

{$INCLUDE filename}

 

The file filename is included into the source.

 

 

The definitions can be set in the options dialog.

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content