What defines control CONDITIONAL compilation in Delphi for platform-specific code?
0 reputation · 24 Jan 2024, 08:13 UTC
Delphi Conditional Compilation Defines
The $IFDEF compiler directive enables platform-specific code sections through conditional compilation. Delphi automatically sets platform defines like MSWINDOWS and MSOSX based on the target platform, but the exact set of available defines varies across Delphi versions.
The {$IFDEF CONDITIONAIREDITOR} directive specifically controls visibility of conditional compile-time constants in the IDE. Cross-platform compilation relies on automatic conditional defines such as CLX versus VCL framework detection, though this behavior changed significantly after Delphi 2009.
Conditional defines can be managed through Project Options > Compiler > Defines in the IDE, but the interaction between automatic platform defines and manually specified ones creates potential conflicts. The documentation for which defines are available in each Delphi version remains inconsistent across release notes.
Questions:
Which conditional defines are automatically available when compiling for iOS versus Android targets in Delphi 11?
How does the CONDITIONAIREDITOR define interact with custom conditional defines specified in project options?
What is the complete list of platform-specific defines for macOS compilation in Delphi 10.4+?