Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi equivalent to Free Pascal's FPC define?

Is there a compiler define that tells if source code is compiled with delphi, in the sense of an equivalent to the FPC define in Free Pascal?

I am developing a unit that should be compatible with three Pascal compilers (Lazarus / Free Pascal, Delphi and winsoft PocketStudio). There are some differences among the compilers, therefore I would like to provide some critical parts of the code in a compiler-specific version.

For Free Pascal I can write

{$IFDEF FPC}
  DoSomething;
{$ENDIF}

but what is the equivalent for Delphi?

like image 887
jwdietrich Avatar asked Jan 16 '14 23:01

jwdietrich


2 Answers

The DCC define was added to the Delphi compiler in XE2. Prior to that, you had to use {$IFDEF VERxxx} statements to check for the presence of individual VERxxx defines for each version of Delphi, or an {$IF DECLARED(CompilerVersion)} statement for Delphi 6+.

like image 99
Remy Lebeau Avatar answered Oct 06 '22 20:10

Remy Lebeau


Documentation predefined conditionals reveals that DCC is a predefined symbol that could be used to separate Delphi from other compilers.

like image 35
LU RD Avatar answered Oct 06 '22 18:10

LU RD