目录
Delphi编译器版本对照表及工具链
1、Delphi编译器版本历史对照表
2、Delphi工具链(Delphi编译器)
3、Delphi条件编译
3.1、预定义条件符号:
3.2、对编译器版本的条件定义:
3.3、预定义常量:
Delphi编译器版本对照表及工具链
1、Delphi编译器版本历史对照表
下表列出了与每个Delphi编译器相关的版本号,从Turbo Pascal 4.0开始,到编译器的当前版本结束:
Delphi conditional VER<nnn> Product Product Version Package Version CompilerVersion
VER350 Delphi 11 Alexandria/ C++Builder 11 Alexandria 28 280 35.0
VER340 Delphi 10.4 Sydney / C++Builder 10.4 Sydney 27 270 34.0
VER330 Delphi 10.3 Rio / C++Builder 10.3 Rio 26 260 33.0
VER320 Delphi 10.2 Tokyo / C++Builder 10.2 Tokyo 25 250 32.0
VER310 Delphi 10.1 Berlin / C++Builder 10.1 Berlin 24 240 31.0
VER300 Delphi 10 Seattle / C++Builder 10 Seattle 23 230 30.0
VER290 Delphi XE8 / C++Builder XE8 22 220 29.0
VER280 Delphi XE7 / C++Builder XE7 21 210 28.0
VER270 Delphi XE6 / C++Builder XE6 20 200 27.0
VER260 Delphi XE5 / C++Builder XE5 19 190 26.0
VER250 Delphi XE4 / C++Builder XE4 18 180 25.0
VER240 Delphi XE3 / C++Builder XE3 17 170 24.0
VER230 Delphi XE2 / C++Builder XE2 16
160161 is the version for the five FireMonkey packages
at XE2 Update 2: fmi161.bpl, fmx161.bpl, fmxase161.bpl,
fmxdae161.bpl, and fmxobj161.bpl.
23.0
VER220 Delphi XE / C++Builder XE 15 150 22.0
VER210 Delphi 2010 / C++Builder 2010 14 140 21.0
VER200 Delphi 2009 / C++Builder 2009 12 120 20.0
VER190 Delphi 2007 for .Net [1] 11 110 19.0
VER180 or VER185 Delphi 2007 / C++Builder 2007 for Win32 [1] 11 110 18.5
VER180 Delphi 2006 / C++Builder 2006 10 100 18.0
VER170 Delphi 2005 9 90 17.0
VER160 Delphi 8 for .Net 8 80 16.0
VER150 Delphi 7 (and 7.1) 7 70 15.0
VER140 Delphi 6 / C++Builder 6 6 60 14.0
VER130 Delphi 5 / C++Builder 5 5 NA NA
VER125 C++Builder 4 4 NA NA
VER120 Delphi 4 4 NA NA
VER110 C++Builder 3 3 NA NA
VER100 Delphi 3 3 NA NA
VER93 C++Builder 1 NA NA NA
VER90 Delphi 2 2 NA NA
VER80 Delphi 1 1 NA NA
VER70 Borland Pascal 7.0 NA NA NA
VER15 Turbo Pascal for Windows 1.5 NA NA NA
VER10 Turbo Pascal for Windows 1.0 NA NA NA
VER60 Turbo Pascal 6.0 NA NA NA
VER55 Turbo Pascal 5.5 NA NA NA
VER50 Turbo Pascal 5.0 NA NA NA
VER40 Turbo Pascal 4.0 NA NA NA
Delphi 2007定义了两个VERxxx符号(VER180和VER185)。Delphi 2006和2007是二进制兼容的,因此两者均可使用180。如果仅需要2007,请使用VER185。
注意: CompilerVersion最初是随Delphi 6引入的,因此较早的版本没有CompilerVersion常量。
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Compiler_Versions
2、Delphi工具链(Delphi编译器)
Platform(平台) Compiler(编译器)
32-bit Windows
DCC32
64-bit Windows
DCC64
64-bit iOS
DCCIOSARM64 (LLVM)
iOS Simulator
DCCIOS32
Android
DCCAARM (LLVM)
Linux
DCCLINUX64
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Delphi_Toolchains
3、Delphi条件编译
您可以通过以下方式定义条件:
使用{$DEFINE}伪指令将指定的符号设置为True,并将{$UNDEF}伪指令设置为False。
将此-D开关与命令行编译器一起使用(所有Delphi编译器均支持此选项)。
将符号添加到“项目”>“选项”>“ Delphi编译器”页面上的“条件定义”字段中。
有条件的指令{$IFDEF},{$IFNDEF},{$IF},{$ELSEIF},{$ELSE},{$ENDIF},并{$IFEND}允许您根据条件符号的状态,编译或抑制代码。{$IF}并{$ELSEIF}允许您基于声明的Delphi标识符进行条件编译。{$
IFOPT}根据是否启用了指定的编译器开关来编译或抑制代码。
3.1、预定义条件符号:
Category Symbol DCC32 DCC64
Since XE2 DCCOSX
Since XE2 DCCOSX64
Since 10.3 Rio Release 2 DCCIOSARM
Since XE3 DCCIOS32
Since XE3 DCCAARM
In XE5 DCCIOSARM64
Since XE8 DCCLINUX64
Since 10.2 Tokyo DCCAARM64
Since 10.3 Rio Release 3 Comments
Compiler DCC DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
VER340
For a list of compiler versions, see Compiler Versions. DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED For Delphi Sydney, compiler version
34.0 has VER340 defined.
Platform CONSOLE DEFINED DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED Defined if an application is being compiled as a
console application.
IOS not defined not defined not
defined not defined DEFINED DEFINED N/A DEFINED not
defined not defined Defined if the target platform is iOS.
*New* in XE4/iOS.
IOS32 not defined not defined not defined not defined
DEFINED DEFINED not defined not defined not defined not
defined Defined if the target platform is iOS32.
Since XE8/iOSarm64.
IOS64 not defined not defined not defined not defined
not defined not defined not defined DEFINED not defined
not defined Defined if the target platform is iOS64.
Since XE8/iOSarm64.
NATIVECODE DEFINED DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED Since Delphi.Net
MSWINDOWS DEFINED DEFINED not defined not defined not
defined not defined not defined not defined not defined
not defined Indicates that the operating environment is Windows. Use
MSWINDOWS to test for any flavor of the Windows platform instead of
WIN32.
WIN32 DEFINED not defined not defined not
defined not defined not defined not defined not defined
not defined not defined Target platform is the native 32-bit
Windows platform.
WIN64 not defined DEFINED not defined
not defined not defined not defined not defined not
defined not defined not defined Target platform is 64-bit
Windows.
*New* in XE2/x64.
MACOS not defined not defined
DEFINED DEFINED DEFINED DEFINED not defined DEFINED
not defined not defined Target platform is macOS.
*New* in XE2/macOS.
MACOS32 not defined not defined DEFINED not defined
DEFINED DEFINED not defined not defined not defined not
defined Target platform is 32-bit macOS.
*New* in XE2/macOS.
MACOS64 not defined not defined not defined DEFINED not
defined not defined not defined DEFINED not defined not
defined Target platform is 64-bit macOS.
*New* in XE8/macOS.
LINUX not defined not defined not defined not defined not
defined not defined not defined not defined DEFINED not
defined Since Kylix.
LINUX32 not defined not defined not
defined not defined not defined not defined not defined
not defined not defined not defined Since Kylix.
LINUX64
not defined not defined not defined not defined not
defined not defined not defined not defined DEFINED not
defined New in 10.2
POSIX not defined not defined
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED Since Kylix.
POSIX32 not defined not
defined DEFINED not defined DEFINED DEFINED DEFINED
DEFINED not defined not defined Since Kylix.
POSIX64
not defined not defined not defined DEFINED not defined
not defined not defined DEFINED DEFINED DEFINED Since
Kylix.
ANDROID not defined not defined not defined not
defined not defined not defined DEFINED not defined not
defined DEFINED Defined if the target platform is Android.
*New* in XE5.
ANDROID32 not defined not defined not defined not defined
not defined not defined DEFINED not defined not defined
not defined Since XE8/iOSarm64.
ANDROID64 not defined not
defined not defined not defined not defined not defined
not defined not defined not defined DEFINED Delphi compiler
for Android 64-bit platform.
*New* in 10.3.3.
CPU CPU386
DEFINED not defined DEFINED DEFINED not defined
DEFINED not defined not defined note defined not defined
Indicates that the CPU is an Intel 386 or later.
CPUX86
DEFINED not defined DEFINED not defined not defined
DEFINED not defined not defined not defined not defined
CPU is an Intel 386 or later on any platform.
*New* in XE2/x64.
CPUX64 not defined DEFINED not defined DEFINED not
defined not defined not defined not defined DEFINED not
defined The CPU supports the x86-64 instruction set, and is in a
64-bit environment.
*New* in XE2/x64.
CPU32BITS DEFINED
not defined DEFINED not defined DEFINED DEFINED
DEFINED not defined not defined not defined The CPU is in a
32-bit environment, such as DCC32.EXE.
*New* in XE8.
CPU64BITS not defined DEFINED not defined DEFINED not
defined not defined not defined DEFINED DEFINED DEFINED
The CPU is in a 64-bit environment, such as DCC64.EXE.
*New* in XE8.
CPUARM not defined not defined not defined not defined
DEFINED not defined DEFINED DEFINED not defined
DEFINED Defined if the CPU is based on the ARM architecture, such as
the Delphi mobile compiler for the iOS device (DCCIOSARM.EXE).
*New* in XE4/iOS.
CPUARM32 not defined not defined not defined not defined
DEFINED not defined DEFINED not defined not defined not
defined The CPU is in a 32-bit ARM environment, such as
DCCIOSARM.EXE.
*New* in XE8.
CPUARM64 not defined not
defined not defined not defined not defined not defined
not defined DEFINED not defined DEFINED The CPU is in a
64-bit ARM environment, such as DCCIOSARM64.EXE.
*New* in XE8.
Availability
ALIGN_STACK not defined not defined DEFINED not defined
not defined DEFINED not defined not defined not defined
not defined Defined in code that may be shared with the macOS
compiler and another compiler on another platform such as Linux that
does not have a rigid stack alignment requirement. For more information,
see Eli Boling's blog at
http://blogs.embarcadero.com/eboling/2009/05/20/5607 .
*New* in XE2/macOS.
ASSEMBLER DEFINED DEFINED DEFINED not defined not
defined DEFINED not defined not defined not defined not
defined Assembler syntax is accepted.
AUTOREFCOUNT (*) not
defined not defined not defined DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED if 10.2.
Not defined since 10.3.
not defined Defined for compilers that use automatic reference
counting, such as the Delphi mobile compilers.
*New* in XE4/iOS. Removed in 10.4 Sydney.
EXTERNALLINKER not defined not defined not defined
DEFINED DEFINED not defined DEFINED DEFINED DEFINED
DEFINED Defined for compilers that have an external linker and the
LLVM code generator; the Delphi mobile compilers have the external ld
linker and use LLVM as code generator.
*New* in XE4/iOS.
UNICODE DEFINED DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED UNICODE is
defined as the default string type.
CONDITIONALEXPRESSIONS
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED DEFINED Tests for the use of the
$IF directive.
ELF not defined not defined not defined
not defined not defined not defined not defined not
defined DEFINED not defined Defined when targeting Executable
and Linkable Format (ELF) files.
NEXTGEN (*) not defined not
defined not defined DEFINED DEFINED DEFINED DEFINED
DEFINED DEFINED if 10.2.
Not defined since 10.3. not
defined Defined for compilers (such as the Delphi mobile compilers)
that use "next-generation" language features, such as 0-based strings.
*New* in XE4/iOS. Removed in 10.4 Sydney.
PC_MAPPED_EXCEPTIONS not defined not defined DEFINED not
defined not defined DEFINED not defined not defined not
defined not defined Defined when compiling on a platform or for a
target platform that uses address maps instead of stack frames to unwind
exceptions (such as macOS).
*New* in XE2.
PIC never
never always DEFINED always DEFINED always DEFINED always
DEFINED always DEFINED always DEFINED always DEFINED always
DEFINED Defined for platforms that require Position-Independent Code
(PIC), such as macOS.
UNDERSCOREIMPORTNAME DEFINED not
defined DEFINED not defined not defined DEFINED not
defined not defined not defined not defined Defined for
compilers that add a leading underscore (for example, in names of
dynamic libraries imported from Mac OS).
*New* in XE4/iOS.
WEAKREF not defined not defined not defined DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
Defined for compilers that can use weak references (the [weak]
attribute).
*New* in XE4/iOS.
WEAKINSTREF (*) not defined
not defined not defined DEFINED DEFINED DEFINED
DEFINED DEFINED DEFINED if 10.2.
Not defined since 10.3. not defined Defined when weak references are defined for instances.
*New* in XE4/iOS. Removed in 10.4 Sydney.
WEAKINTFREF not defined not defined not defined DEFINED
DEFINED DEFINED DEFINED DEFINED DEFINED DEFINED
Defined when weak references are defined for interfaces.
*New* in XE4/iOS.
3.2、对编译器版本的条件定义:
{$ IFDEF CONDITIONALEXPRESSIONS}
{$ IF CompilerVersion> = 17.0}
{$ DEFINE HAS_INLINE}
{$ IFEND}
{$ IF RTLVersion> = 14.0}
{$ DEFINE HAS_ERROUTPUT}
{$ IFEND}
{$ ENDIF}
3.3、预定义常量:
仅在条件编译器指令(例如{$IF}和)内部接受条件语句{$IFDEF}。
有三个重要的常量可用:
System.RTLVersion是一个常量,定义为运行时库的版本。对于悉尼,RTLVersion为34。
System.CompilerVersion是一个常量,定义为当前Delphi编译器的版本。对于悉尼,CompilerVersion为34。
FMX.Types.FireMonkeyVersion是一个常量,定义为当前FireMonkey库的版本。对于悉尼,FireMonkeyVersion为270。
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Conditional_compilation_(Delphi)
————————————————
版权声明:本文为CSDN博主「pulledup」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/pulledup/article/details/114275617