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:
- the IDE ignores it and shows filename.exe in the compile progress dialog
- linker partially ignores it and creates
filename.4gb
instead offilename.3gb.exe
I did know about the various $LIBxxx
directives that were introduced in Delphi 2009 when it [WayBack] was released in 2008.
Related:
- [WayBack] Compiler directives for libraries or shared objects (Delphi 2009):
{$LIBPREFIX 'string'}
,{$LIBSUFFIX 'string'}
,{$LIBVERSION 'string'}
- [WayBack] Executable extension (Delphi 2007)
- [WayBack] Executable extension (Delphi 2009)
- [WayBack] Executable extension (Delphi 10.3 Rio) – RAD Studio
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:
- [WayBack] Delphi 2007 Compiler Directives (List)
- [WayBack] Delphi 2009 Compiler Directives (List)
- [WayBack] Delphi 10.3 Rio Compiler Directives (List) Index – RAD Studio
–jeroen
Leave a comment