英文:
Compile-Time detection of >= Alexandria 11.3
问题
我怎么(在编译时)检测到 Alexandria 11.2 和 11.3 之间的差异(或者更确切地说,如何检测您是否处于 11.3 或更高版本?)
两者的 CompilerVersion 和 RTLVersion 值都为 35。
英文:
How do you (compile-time) detect the difference between Alexandria 11.2 and 11.3 (or, rather, how do you detect you are at 11.3 or later?)
Both have CompilerVersion and RTLVersion value at 35.
答案1
得分: 6
有常量 RTLVersion111
、RTLVersion112
和 RTLVersion113
,根据编译的版本而声明。可以这样检测它们:
{$IF declared(RTLVersion113)}
...
{$IFEND}
英文:
There are constants RTLVersion111
, RTLVersion112
and RTLVersion113
declared depending on the version you are compiling with. These can be detected like this:
{$IF declared(RTLVersion113)}
...
{$IFEND}
答案2
得分: 0
{$IF CompilerVersion > 35 }
{$DEFINE Alexandria3 }
{$ELSEIF CompilerVersion < 35 }
{$UNDEF Alexandria3 }
{$ELSEIF Declared(RTLVersion113) }
{$DEFINE Alexandria3 }
{$ELSE }
{$UNDEF Alexandria3 }
{$ENDIF }
现在你可以使用
{$IFDEF Alexandria3 }
来有条件地编译适用于Alexandria3或更高版本的代码。
英文:
Extended Answer, based on Uwe Raabe's answer:
{$IF CompilerVersion > 35 }
{$DEFINE Alexandria3 }
{$ELSEIF CompilerVersion < 35 }
{$UNDEF Alexandria3 }
{$ELSEIF Declared(RTLVersion113) }
{$DEFINE Alexandria3 }
{$ELSE }
{$UNDEF Alexandria3 }
{$ENDIF }
Now you can
{$IFDEF Alexandria3 }
to conditionally compile code for Alexandria3 or later.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论