【Delphi】 Delphi 编译器版本号对照

判断当前 Delphi 的运行库版本:

procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowMessage(FloatToStr(System.CompilerVersion));
end;

编译时可以判断版本号:

{$IF CompilerVersion >= 18.5}
//some code only compiled for Delphi 2007 and later
{$IFEND}
{$IFDEF CONDITIONALEXPRESSIONS}
   {$IF CompilerVersion >= 17.0}
     {$DEFINE HAS_INLINE}
   {$IFEND}
   {$IF RTLVersion >= 14.0}
     {$DEFINE HAS_ERROUTPUT}
   {$IFEND}
{$ENDIF}
{$if defined(FPC) or defined(VER170) or defined(VER180) or defined(VER190)
  or defined(VER200) or defined(VER210) or defined(VER220) or defined(VER230)
  or defined(VER240)  or defined(VER250) or defined(VER260)}
  {$DEFINE HAVE_INLINE}
{$ifend}

{$if defined(VER210) or defined(VER220) or defined(VER230) or defined(VER240)
  or defined(VER250) or defined(VER260)}
  {$define HAVE_RTTI}
{$ifend}

{$if defined(VER230) or defined(VER240) or defined(VER250) or defined(VER260)}
  {$define NEED_FORMATSETTINGS}
{$ifend}

{$if defined(FPC) and defined(VER2_6)}
  {$define NEED_FORMATSETTINGS}
{$ifend}

编译版本对照表

条件版本号 VER CompilerVersion 产品名称 产品版本 包版本 编译目标平台 备注
VER340 34.0 Delphi 10.4 Sydney 27 270 Win32,Win64,OSX,iOS,iOS32,iOS64,Android,MACOS,LINUX
VER330 33.0 Delphi 10.3 Rio 26 260 Win32,Win64,OSX,iOS32,iOS64,Android
VER320 32.0 Delphi 10.2 Tokyo 25 250 Win32,Win64,OSX,iOS32,iOS64,Android
VER310 31.0 Delphi 10.1 Berlin 24 240 Win32,Win64,OSX,iOS32,iOS64,Android
VER300 30.0 Delphi 10 Seattle 23 230 Win32,Win64,OSX,iOS32,iOS64,Android
VER290 29.0 Delphi XE8 22 220 Win32,Win64,OSX,iOS32,iOS64,Android
VER280 28.0 Delphi XE7 21 210 Win32,Win64,OSX,iOS,Android
VER270 27.0 Delphi XE6 20 200 Win32,Win64,OSX,iOS,Android
VER260 26.0 Delphi XE5 19 190 Win32,Win64,OSX,iOS,Android
VER250 25.0 Delphi XE4 18 180 Win32,Win64,OSX,iOS
VER240 24.0 Delphi XE3 17 170 Win32,Win64,OSX
VER230 23.0 Delphi XE2 16 160 Win32,Win64,OSX 161是Update2
VER220 22.0 Delphi XE2 15 150 Win32
VER210 21.0 Delphi 2010 14 140 Win32
VER200 20.0 Delphi 2009 12 120 Win32
VER190 19.0 Delphi 2007 for .Net * 11 110
VER180 or VER185 18.5 Delphi 2007 for Win32 11 110
VER180 18.0 Delphi 2006 10 100
VER170 17.0 Delphi 2005 9 90
VER160 16.0 Delphi 8 for .Net 8 80
VER150 15.0 Delphi 7(and 7.1) 7 70
VER140 14.0 Delphi 6 6 60
VER130 NA Delphi 5 5 NA
VER125 NA C++Builder 4 4 NA
VER120 NA Delphi 4 4 NA
VER110 NA C++Builder 3 3 NA
VER100 NA Delphi 3 3 NA
VER90 NA Delphi 2 2 NA
VER80 NA Delphi 1 1 NA

Delphi 2007定义了两个VERXX符号 (VER180VER185)。Delphi 2006Delphi 2007是二进制兼容的,因此两者均可使用VER180。如果仅需要2007,请使用VER185

注意: CompilerVersion 最初是随 Delphi 6 引入的,因此较早的版本没有此常量。

编译指令 Compiler Directives

Delphi Compiler Directive Associated Symbol
Align fields (Delphi) {$A},{$ALIGN}
Application type (Delphi) {$APPTYPE}
Assert directives (Delphi) {$C},{$ASSERTIONS}
Boolean short-circuit evaluation (Delphi compiler directive) {$B},{$BOOLEVAL}
Code align (Delphi) {$CODEALIGN}
Conditional compilation (Delphi) {$IFDEF}, {$IFNDEF}, {$IF}, {$ELSEIF}, {$ELSE}, {$ENDIF}, {$IFEND}
Debug information (Delphi) {$D},{$DEBUGINFO}
DEFINE directive (Delphi) {$DEFINE}
DENYPACKAGEUNIT directive (Delphi) {$DENYPACKAGEUNIT}
Description (Delphi) {$D},{$DESCRIPTION}
DESIGNONLY directive (Delphi) {$DESIGNONLY}
ELSE (Delphi) {$ELSE}
ELSEIF (Delphi) {$ELSEIF}
ENDIF directive (Delphi) {$ENDIF}
Executable extension (Delphi) {$E},{$EXTENSION}
Export symbols (Delphi) {$ObjExportAll}
Extended syntax (Delphi) {$X},{$EXTENDEDSYNTAX}
Extended type compatibility (Delphi) {$EXTENDEDCOMPATIBILITY}
External Symbols (Delphi) {$EXTERNALSYM [ 'typeNameInHpp' [ 'typeNameInHppUnion' ]]}
Floating point precision control (Delphi for x64) {$EXCESSPRECISION}
HIGHCHARUNICODE directive (Delphi) {$HIGHCHARUNICODE}
Hints (Delphi) {$HINTS}
HPP emit (Delphi) {$HPPEMIT}
IFDEF directive (Delphi) {$IFDEF}
IF directive (Delphi) {$IF}
IFEND directive (Delphi) {$IFEND}
IFNDEF directive (Delphi) {$IFNDEF}
IFOPT directive (Delphi) {$IFOPT}
Image base address {$IMAGEBASE}
Implicit Build (Delphi) {$IMPLICITBUILD}
Imported data {$G},{$IMPORTEDDATA}
Include file (Delphi) {$I},{$INCLUDE}
Input output checking (Delphi) {$I},{$IOCHECKS}
Compiler directives for libraries or shared objects (Delphi) {$LIBPREFIX}, {$LIBSUFFIX}, {$LIBVERSION}
Legacy IFEND (Delphi) {$LEGACYIFEND}
Link object file (Delphi) {$L file},{$LINK file}
Local symbol information (Delphi) {$L+},{$LOCALSYMBOLS}
Long strings (Delphi) {$H},{$LONGSTRINGS}
Memory allocation sizes (Delphi) {$M},{$MINSTACKSIZE},{$MAXSTACKSIZE}
MESSAGE directive (Delphi) {$MESSAGE }
METHODINFO directive (Delphi) {$METHODINFO}
Minimum enumeration size (Delphi) {$Z1},{$Z2},{$Z4},{$MINENUMSIZE 1},{$MINENUMSIZE 2},{$MINENUMSIZE 4}
NODEFINE directive (Delphi) {$NODEFINE [ 'typeNameInHpp' [ 'typeNameInHppUnion' ]]}
NOINCLUDE (Delphi) {$NOINCLUDE}
OBJTYPENAME directive (Delphi) {$OBJTYPENAME typeIdent ['{B|N}typeNameInObj']}
Old type layout (Delphi) {$OLDTYPELAYOUT ON}
Open String Parameters (Delphi) {$P},{$OPENSTRINGS}
Optimization (Delphi) {$O},{$OPTIMIZATION}
Overflow checking (Delphi) {$Q},{$OVERFLOWCHECKS}
PE (portable executable) header flags (Delphi) {$SetPEFlags},{$SetPEOptFlags}
PE header operating system version {$SETPEOSVERSION}
PE header subsystem version {$SETPESUBSYSVERSION}
PE header user version {$SETPEUSERVERSION}
Pentium-safe FDIV operations (Delphi) {$U},{$SAFEDIVIDE}
Pointer Math (Delphi) {$POINTERMATH}
Range checking {$R},{$RANGECHECKS}
Real48 compatibility (Delphi) {$REALCOMPATIBILITY}
Regions {$REGION},{$ENDREGION}
Reserved address space for resources (Delphi, Linux) {$M},{$RESOURCERESERVE}
Resource file (Delphi) {$R},{$RESOURCE}
RTTI directive (Delphi) {$RTTI INHERIT|EXPLICIT}
RUNONLY directive (Delphi) {$RUNONLY}
Run-Time Type Information (Delphi) {$M},{$TYPEINFO}
Scoped Enums (Delphi) {$SCOPEDENUMS}
Stack frames (Delphi) {$W},{$STACKFRAMES}
Strong link types (Delphi) {$STRONGLINKTYPES}
Symbol declaration and cross-reference information (Delphi) {$Y},{$REFERENCEINFO},{DEFINITIONINFO}
Type-checked pointers (Delphi) {$T},{$TYPEDADDRESS}
UNDEF directive (Delphi) {$UNDEF}
Var-string checking (Delphi) {$V},{$VARSTRINGCHECKS}
Warning messages (Delphi) {$WARN}
Warnings (Delphi) {$WARNINGS}
Weak packaging {$WEAKPACKAGEUNIT}
WEAKLINKRTTI directive (Delphi) {$WEAKLINKRTTI}
Writeable typed constants (Delphi) {$J},{$WRITEABLECONST}
Zero-based strings (Delphi) {$ZEROBASEDSTRINGS}

In the table column heads:

DCC32 is the 32-bit Windows Delphi compiler.
DCC64 is the 64-bit Windows Delphi compiler.
DCCOSX is the Mac OS X Delphi compiler.
DCCIOSARM is the Delphi compiler for 32-bit iOS Devices.
DCCIOS32 is the Delphi compiler for iOS Simulators.
DCCAARM.EXE is the Delphi compiler for Android devices.
DCCIOSARM64 is the Delphi compiler for 64-bit iOS devices.

posted @ 2016-08-27 18:52  我爱我家喵喵  阅读(12485)  评论(0编辑  收藏  举报