Linking

From RAD Studio
Jump to: navigation, search

Go Up to Delphi Compiler


Project > Options > Building > Delphi Compiler > Linking

Use this page to set linker options for your application.

Attention: Not all the options described below are available for all types of projects.
Options Description

Target, Apply, Save

See Target Options.

Common items

See Common Items on Project Options Pages.


Linking Option Description Compiler switches All platforms supported unless noted

Data Execution Prevention compatible

Specifies whether the executable image is compatible with Windows Data Execution Prevention.
Default = True

‑‑nx-compat
‑‑nx-compat:off

  • 32‑bit Windows
  • 64‑bit Windows

Debug information

Generates a line-number table for each procedure that maps object-code addresses into source text line numbers. Equivalent to the {$D+} Delphi compiler directive and the -V switch for DCC32.

Default = False

‑$D+
‑$D‑

Enable Large addresses

Specifies whether the object supports addresses that are larger than two gigabytes.
Default = False

‑‑large-address-aware
‑‑large-address-aware:off

  • 32‑bit Windows

EXE Description

Enter a description of your EXE file. This field can contain a string of as many as 255 characters. The string is linked to $D and included in the executable file. It is most often used to insert copyright information into the application. Copyright information can also be included as part of the VersionInfo file. Note that this option is only applicable to DLLs and application executables but not to packages.

‑‑description

Generate console application

Causes the linker to set a flag in the .exe file of the application indicating a console mode application.

Default = False

‑CC

Image Base

Specifies the preferred load address of the compiled image. This value is typically only changed when compiling DLLs.

Default = 400000

‑K

Include remote debug symbols

Check this if you are using remote or multi-device debugging. Generates the remote debug symbols file (.rsm) for the project.

Default = False

‑VR

  • 32‑bit Windows
  • 64‑bit Windows
  • macOS 
  • iOS Simulator

Map file

The linker can generate a map file that contains general segment information, including a list of segments, the program start address, and any warning or error messages produced during the link.

Default = Off

  • Off: Produces no map file. This is the default.
  • Segments: Produces a map file that includes a list of segments, the program start address, and any warning or error messages produced during the link.
  • Publics: Produces a map file that includes a list of segments, the program start address, any warning or error messages produced during the link, and a list of alphabetically sorted public symbols.
  • Detailed: Produces a map file that includes a list of segments, the program start address, any warning or error messages produced during the link, a list of alphabetically sorted public symbols, and an additional detailed segment map. The detailed segment map includes the segment address, length in bytes, segment name, group, and module information. Also produces a resource string file.

‑GS
‑GP
‑GD

  • 32‑bit Windows
  • 64‑bit Windows
  • macOS 
  • iOS Simulator

Map file ARM

The linker can generate a map file that contains general segment information, including a list of segments, the program start address, and any warning or error messages produced during the link.

Default = Off

  • Off: Produces no map file. This is the default.
  • On: Produces a map file.
  • Map file and .drc file: Produces both a map file and a drc file.

‑G
‑GD

  • iOS Device (32-bit and 64-bit)

Maximum stack size

Indicates the total reserved size of the stack (only applicable to executable projects; disabled for DLLs). Memory-size settings can also be specified in your source code with the $M compiler directive.

Default = 1048576

Minimum iOS version supported

The minimum iOS version that your application supports. When you submit your application to the App Store, this value is used for filtering purposes.

Default = 8.0

‑‑ios-version-min

  • iOS Device (32-bit and 64-bit)

Minimum stack size

Indicates the initial committed size of the stack (only applicable to executable projects; disabled for DLLs). Memory-size settings can also be specified in your source code with the $M compiler directive.

Default = 16384

Options passed to the LD linker

Additional options for the LD linker.

‑‑linker-option

  • iOS Device (32-bit and 64-bit)

Output resource string .drc file

Creates a .drc file that contains the resource strings for the current project. For more information, see Adding Languages to a Project.

‑‑drc

Place debug information in a separate TDS file

Stores C++-style debug information in a separate .tds file with the same name as the project. This TDS debug file is generated at compile-time and contains information used by the debugger. If you want the debug information to be generated directly in the PE file, set the Debug Information option to True.

When loading a C++ module, the debugger examines the timestamp of the accompanying .tds file. If the timestamp of the .tds file is older than that of the module by 5 seconds or more, the debugger considers the .tds file to be stale and therefore does not use it. Likewise, the IDE Event Log reports that no debug information was found for the module. To avoid the problem of a missing .tds file, do either of the following:

  • Make sure that all of your build processes (IDE and command line) and configurations are consistent with regards to the "Place debug information in a separate TDS file" option.
  • Delete the matching .tds of a module when rebuilding the module.

Default = False

‑VT ‑VN

  • 32‑bit Windows

Set base address for relocatable images

Controls the default load address for an application, DLL, or package. The number argument must be:

  • A 32-bit integer value that specifies the image base address.
  • Greater than or equal to $00010000; the lower 16 bits of the argument are ignored and should be zero.
  • A multiple of 64K (that is, a hex number must have zeros as the last 4 digits); otherwise it will be rounded down to the nearest multiple, and you will receive a compiler message.

This option is equivalent to the {$IMAGEBASE} Delphi compiler directive.

Default = 0

‑K

Set extra PE header flags

Specifies additional flags for the PE (Portable Executable) header for your application.
Sets the field or fields that you specify to the values you specify. This option is equivalent to the {$SETPEFLAGS xxx} Delphi compiler directive.

Default = 0

‑‑peflags

  • 32‑bit Windows
  • 64‑bit Windows

Set extra PE header optional flags

Sets additional header fields in the PE (Portable Executable) file optional header. For details, see the IMAGE_OPTIONAL_HEADER structure as defined in the WINNT.h file.

Default = 0

‑‑peoptflags

  • 32‑bit Windows
  • 64‑bit Windows

Set OS version fields in PE header as <major>.<minor>

Specifies the operating system version that is required to run the image. Sets the MajorOperatingSystemVersion field in the PE (Portable Executable) file optional header to the value you specify as <major>. Also sets the MinorOperatingSystemVersion field to the value you specify as <minor>. For example, entering 5.0 in this field specifies the OS version as Windows 2000 in the PE file optional header. The fields are defined in the WINNT.h file under IMAGE_OPTIONAL_HEADER.

This option is equivalent to the {$SETPEOSVERSION} Delphi compiler directive.

Default = 5.0

‑‑peosversion

  • 32‑bit Windows
  • 64‑bit Windows

Set subsystem version fields in PE header as <major>.<minor>

Specifies the Windows subsystem that is required to run the image, for a PE (Portable Executable) file. Sets the MajorSubsystemVersion field in the PE file optional header to the value you specify as <major>. Also sets the MinorSubsystemVersion field to the value you specify as <minor>.

This option is equivalent to the {$SETPESUBSYSVERSION} Delphi compiler directive.

Default = 5.0
The following values for Subsystem are defined in the WINNT.h file:

  • IMAGE_SUBSYSTEM_UNKNOWN = 0: Unknown subsystem
  • IMAGE_SUBSYSTEM_NATIVE = 1: Used for device drivers and native Windows NT processes
  • IMAGE_SUBSYSTEM_WINDOWS_GUI = 2: Image runs in the Windows graphical user interface (GUI) subsystem.
  • IMAGE_SUBSYSTEM_WINDOWS_CUI = 3: Image runs in the Windows character subsystem.
  • IMAGE_SUBSYSTEM_POSIX_CUI = 7: Image runs in the Posix character subsystem.

‑‑pesubsysversion

  • 32‑bit Windows
  • 64‑bit Windows

Set user version fields in PE header as <major>.<minor>

Specifies the version number of your application. Sets the MajorVersion field in the PE (Portable Executable) file optional header to the value you specify as <major>. Also sets the MinorVersion field to the value you specify as <minor>. For example, entering 8.11 in this field specifies the application version as 8.11 in the PE file optional header. The fields are defined in the WINNT.h file under IMAGE_OPTIONAL_HEADER.

This option is equivalent to the {$SETPEUSERVERSION} Delphi compiler directive.

Default = 0

‑‑peuserversion

  • 32‑bit Windows
  • 64‑bit Windows

Support address space layout randomization (ASLR)

Specifies whether the DLL or executable image can be randomly rebased at load-time by using address space layout randomization (ASLR).
Default = True

‑‑dynamic-base
‑‑dynamic-base:off

  • 32‑bit Windows
  • 64‑bit Windows

Support high-entropy 64-bit address space layout randomization (ASLR)

Specifies whether the DLL or executable image supports high entropy (64-bit) address space layout randomization (ASLR).
Default = True

Note: This flag is only available in Win64.

‑‑high-entropy-va
‑‑high-entropy-va:off

  • 64‑bit Windows

Terminal Server

Specifies that the app is designed to run in a multi-user environment.
Default = True

‑‑ts-aware
‑‑ts-aware:off

  • 32‑bit Windows
  • 64‑bit Windows

See Also