The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,261 other subscribers

Learned about the {$EXTENSION zzz} or {$E zzz} Delphi directive: {$EXTENSION yyy.zzz} fails

Posted by jpluimers on 2020/10/29

I totally missed that this has been added in Delphi a long time ago (at least in Delphi 2007 or maybe even before): the {$EXTENSION zzz} or {$E zzz} Delphi directive that sets the file extension of the output: [WayBack] Executable extension (Delphi 2007)

[WayBack] Executable extension (Delphi 10.3 Rio) – RAD Studio explains this is equivalent to using the -TZ

The documentation explains the zzz to be a string, but in practice, using {$EXTENSION yyy.zzz} and {$E yyy.zzz} fail:

[WayBack] Little funny bug… I wanted to quickly make two x86 EXE builds, with 3GB and normal 2GB of available memory. Just to pass it for heavy testing, as 3rd… – Arioch The – Google+ explains how to use this as a trick to have a different extension for 3GB aware compiled 32-bit executables:

{$DEFINE g3} // or obvious {.$DEFINE g3}
{$IFDEF g3}
  {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
  {$EXTENSION 3GB.EXE}
{$ENDIF}

This kind of work in XE2 but with two funny bugs:

  1. the IDE ignores it and shows filename.exe in the compile progress dialog
  2. linker partially ignores it and creates filename.4gb instead of filename.3gb.exe

I did know about the various $LIBxxx directives that were introduced in Delphi 2009 when it [WayBack] was released in 2008.

Related:

One day, I might create an overview of which directives are valid in what Delphi versions. That would be a big change of List-Delphi-Installed-Packages.ps1, which would need at least these:

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.