Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect specific Delphi builds?

This is related to another Delphi-version question but still different;

I'm looking for a way to detect the service-pack (or build number) of the Delphi compiler that's compiling my code. The jedi.inc is nice, but it doesn't tell me the exact version. (I can't use the SUPPORTS_* defines in there either, as those are version-related too)

I need this, because some bugs are present in older versions (in this case, it's a _ValLong bug in Delphi 2009) that's fixed in a later service-pack (Delphi 2009 service pack 3 in this case).

Currently I have all kinds of checks in my code, like this :

{$IFDEF BUG_QC_68123}

But I can't just say this in my main include file :

{$IFDEF DELPHI2009_UP}
  {$DEFINE BUG_QC_68123}
{$ENDIF}

...As this would miss the fact that D2009SP3 and later don't have this bug anymore.

Any ideas?

PS: This will probably also apply to older (and newer) versions of Delphi, so any library- and/or component-vendor will have an interest in this too, I presume.

like image 663
PatrickvL Avatar asked Nov 23 '25 21:11

PatrickvL


2 Answers

There are symbols defined for each version:

VER80 - Delphi 1
VER90 - Delphi 2
VER100 - Delphi 3
VER120 - Delphi 4
VER130 - Delphi 5
VER140 - Delphi 6
VER150 - Delphi 7
VER160 - Delphi 8
VER170 - Delphi 2005
VER180 - Delphi 2006
VER180 - Delphi 2007
VER185 - Delphi 2007 (Note: symbol VER185, for example, is used to indicate Delphi 2007 compiler or an earlier version.)
VER190 - Delphi 2007 for .NET
VER200 - C++ Builder 2009
VER210 - Delphi 2010
VER220 - Delphi XE
VER230 - Delphi XE2
VER240 - Delphi XE3
VER250 - Delphi XE4
VER260 - Delphi XE5
VER270 - Delphi XE6
VER280 - Delphi XE7
WIN32 - Indicates that the operating environment is the Win32 API.
LINUX - Indicates that the operating environment is Linux
MSWINDOWS - Indicates that the operating environment is the MS Windows/li] 
CONSOLE - Indicates that an application is being compiled as a console application

Source Another source You can't check for different build numbers.

And for the curious, VER10-VER70 where the turbo pascal versions, and VER110 was a C++ builder version.

like image 179
Toon Krijthe Avatar answered Nov 25 '25 10:11

Toon Krijthe


Unfortunately, constants like RTLVersion in System.pas aren't updated in updates, but I think it would be a good suggestion if someone wants to make a QC entry for it.

If the bugs you are testing for are practical to reproduce in code, you could always test for them on startup and set your own global flags.

I get around these differences by making sure we always apply the latest updates. I haven't run in to a case yet where an update was unstable and forced me to roll it back. At least not with Delphi.

like image 36
Bruce McGee Avatar answered Nov 25 '25 11:11

Bruce McGee