Search code examples
delphiversion-detection

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.


Solution

  • You could try including the compiler file version in your software. For example, DCC32.exe has a file version on it which you can programmatically get at and then write to a unit as a const. This could be done as part of your build process so it gets the version info before building your app (it'd be very easy to do with something like FinalBuilder).

    I've done this for other things so that on our About screen we can get various bits of useful info. Also when we have an error in one our applications, we can bundle this info into our EurekaLog bug reports.

    However I don't know if the file version on DCC32.exe is updated with every Delphi update.