C++ Linker

From RAD Studio
Jump to: navigation, search

Go Up to Project Options Dialog Box


Project > Options > C++ Linker

Use this dialog box to set C++ linker options.

Options Description

Target, Apply, Save

See Target Options.

Common items

See Common Items on Project Options Pages.


Linking Options

Linking options Description Linker switches
ilink32 ilink64 xlink ld (iOS) ld (Android)

Disable incremental link

Suppresses the generation of linker state files, disabling incremental linking. If you use the Disable incremental link option, subsequent links take just as long as the first one.
Default = False

-Gn -Gn -Gn Platform not supported Platform not supported

Display time spent on link

Include in the linker output the amount of time required to complete the linking.
Default = False

-t -t -t Platform not supported Platform not supported

Full debug information

Includes information in the output file needed to debug your application with the C++Builder integrated debugger:

On the command line, this option causes the linker to include debugging information in the TDS file for all object modules that contain debugging information. You can use the -v+ and -v- options to selectively enable or disable debugging information on a module-by-module basis (but not on the same command line where you use -v).

For example, the following command includes debugging information for modules mod2 and mod3, but not for mod1 and mod4:

ILINK32 mod1 -v+ mod2 mod3 -v- mod4

Default = False

-v -v -v -S -S

Generate .drc file

ILINK32 generates Delphi-compatible .RC files (.drc files). The .drc file has the same name as the executable file and is emitted to the same directory as the executable file.
Default = False

-GD -GD -GD Platform not supported Platform not supported

Generate .map symbols file

Generates a mapfile in .\OutputFolder\ProjectName.map.
By default, the linker names the map file with the base name of the program and the extension .map
Default = True

For desktop platforms, you set the Map file options on the C++ Linker Output page.

N/A N/A N/A -map (not enabled) -Map (not enabled)

Generate import library

Generates an import library file, a small static library that describes the exports of either a package or a .dll so that an application can link against it.

This file is used when linking dynamic libraries. Without an import library you cannot use the package in C++.

The import library file extension is:

Note: This option appears only for C++ Dynamic-link library projects.

Enabled only for C++ packages.
Default = True

-Gi -Gi -Gi Platform not supported Platform not supported

Generate static package library (.lib)

Generates a statically linkable package library.

Building a C++ static package library (.lib) requires a set of .objs that are different from the .objs used to build the dynamic library (.bpl).

When this option is enabled (the default setting), a build or make command produces two sets of .objs:

  • The .objs for the dynamic library (.bpl) are built with:
    • BCC32 -D_RTLDLL;USEPACKAGES or:
    • DCC32 -JPHNE (Generate C++ .obj file, .hpp file, in namespace, export all)
  • The .objs for the static library (.lib) are built with:
    • BCC32 -U_RTLDLL;USEPACKAGES or:
    • DCC32 -JPHN (Generate C++ .obj file, .hpp file, in namespace)
  • For both types of library, the TLIB Library Manager creates the actual library, in the \bpilib directory.

The .obj files for the static library (.lib) are output into a subdirectory created in your project directory, typically the \Debug\Win32\staticobjs directory. The .obj files for the dynamic library (.bpl) are output into your project directory.

When this option is disabled, a build or make command produces only the dynamic library (.bpl).

For more information, see Building Static Packages.

Enabled only for C++ packages.

Default = True

-Gl -Gl -Gl Platform not supported Platform not supported

Keep output files

Tells the linker to keep output files that would otherwise be deleted on errors. The linker has been changed to delete its output file (EXE/DLL) if there are errors in the link. The old behavior was to leave these files and not delete them.
Default = False

-Gk -Gk -Gk Platform not supported Platform not supported

Link with Dynamic RTL

Controls whether the C RTL links dynamically (or statically) with run-time library (cc3290.dll).
Default = True

N/A N/A N/A N/A N/A

Link with the Delphi Runtime Library
(rtl package and cp32mt.lib/cp32mti.lib)

Ensures that the application is linked with the following:

  • The Delphi RTL package (rtl.lib or rtl.bpi)
  • The memmgr.lib and sysinit.obj units
  • The C++ RTL that is compatible with the Delphi RTL (that is, cp32*.lib).

C++ links with the Delphi RTL if this option is enabled, or if the project has a framework affinity. For example, FMX Forms projects, by virtue of their framework affinity, link with the Delphi RTL. Use this option for any C++ application that has no framework affinity and that you want to use some Delphi types (such as UnicodeString, Variant, and so on) or access some functionality exposed by units in the Delphi RTL package (such as SysUtils, Classes, IOUtils, and so on).

C++ console applications cannot handle Delphi exceptions unless you either enable this option or select a framework when you create the application using the New Console Application (C++) wizard.
Default = False

N/A N/A N/A N/A N/A

Remove the temporary .lnk linker file after linking

This option removes the temporary linker file in .\OutputFolder\ProjectName.lnk.
Default = True

N/A N/A N/A N/A N/A

Specify maximum number of errors

Sets the specified number of errors encountered (nn) before the link is aborted.
Default = 0

-Enn -Enn -Enn Platform not supported Platform not supported

Advanced Options

Advanced options Description Linker switches
ilink32 ilink64 xlink ld (iOS) ld (Android)

Additional options

Enter any additional linker options you want. For options, see ILINK32, the 32-bit Incremental Linker.

N/A N/A N/A N/A N/A

Case sensitive linking

The linker differentiates between upper and lowercase characters in public and external symbols. Normally, this option should be set, since C and C++ are both case-sensitive languages.
Default = True

-c -c -c Platform not supported Platform not supported

Clear state before linking

Deletes the existing incremental linker state files and then recreates these files and continues with the link. This option allows you to refresh the state files.
Default = False

-C -C -C Platform not supported Platform not supported

Delay load .DLLs

Specifies DLLs that are to be delay loaded. Delayed loading of DLLs is useful for DLLs that are used very infrequently by an application, but might have high startup costs. DLLs that have been delay loaded are not loaded and initialized until an entry point in the DLL is actually called. There is accompanying RTL support for delayed load DLLs that the user can hook into to handle errors on loading and to supplant the delayed load system, if so desired. See the description of the Ellipsis pop-up button in Common Items on Project Options Pages.

-d -d -d Platform not supported Platform not supported

Do image checksum

Calculates the checksum of the target and places the result in the target PE header. This is used for NT Kernel mode drivers and system DLLs.
Default = False

-Gz -Gz -Gz Platform not supported Platform not supported

Fast TLS

Allocate TLS (thread-local storage) from Windows instead of using the mechanism to share TLS.
Default = False

-Gt -Gt -Gt Platform not supported Platform not supported

File alignment

Specifies page alignment for code and data within the executable file. The linker uses the file alignment value when it writes the various objects and sections (such as code and data) to the file. For example, if you use the default value of 0x200, the linker stores the section of the image on 512-byte boundaries within the executable file.

When using this option, you must specify a file alignment value that is a power of 2, with the smallest value being 16. The old style of this option (/A:dd) is still supported for backward compatibility. With this option, the decimal number dd is multiplied by the power of 2 to calculate the file alignment value.

The command-line version of this option (/Afxxxx) accepts either decimal or hexadecimal numbers as the file alignment value.
Default = 0x200

-Af -Af -Af Platform not supported Platform not supported

Object alignment

The linker uses the object alignment value to determine the virtual addresses of the various objects and sections (such as code and data) in your application. For example, if you specify an object alignment value of 8192, the linker aligns the virtual addresses of the sections in the image on 8192-byte (0x2000) boundaries.

When using this option, you must specify an object alignment value that is a power of 2, with the smallest value being 4096 (0x1000), the default. The command-line version of this option (/Ao) accepts either decimal or hexadecimal numbers as the object alignment value.
Default = 0x1000

-Ao -Ao -Ao Platform not supported Platform not supported

Replace resources

Add and/or replace resources without stripping away the existing resources.
Default = False

-Rr -Rr -Rr Platform not supported Platform not supported

Verbose linking

Sets the verbose option for RLINK32, and detailed information is emitted during the resource link.
Default = False

-r -r -r Platform not supported Platform not supported

Additionally linked libraries

Links your application against the specified list of libraries.

Specify libraries by codename. For example, to link with MIDAS, add "midas" to the list.

Note: Other advanced options let you link to popular libraries such as Interbase. Use those other options instead of Additionally linked libraries when possible.
Platform not supported Platform not supported Platform not supported -l -l

Link with DBX InterBase

Links with the dbExpress InterBase client library.
Default = True

Platform not supported Platform not supported Platform not supported -lsqlib -lsqlib

Link with Indy

Links with the Indy libraries.
Default = True

Platform not supported Platform not supported Platform not supported -lIndyCore -lIndyProtocols -lIndySystem -lIndyCore -lIndyProtocols -lIndySystem

Link with Interbase ToGo

Links with the dbExpress InterBase ToGo client library.
Default = True

Platform not supported Platform not supported Platform not supported -libtogo -libtogo

Link with Midas

Links with MIDAS, the DataSnap library.
Default = True

Platform not supported Platform not supported Platform not supported -lmidas -lmidas

Link with Regular Expressions.
Default = True

Links with the regular expressions library, the PCRE (Perl-compatible regular expressions) library adapted to C++.
See more information at http://www.pcre.org.
Default = True

Platform not supported Platform not supported Platform not supported -lpcre Platform not supported

Link with SQLite

Links with the dbExpress SQLite client library.
Default = True

Platform not supported Platform not supported Platform not supported -lsqlite3 -lsqlite

Link with SSL and Crypto

Links with the OpenSSL libraries.

See for example Creating an iOS App, OpenSSL Support.
Default = False

Platform not supported Platform not supported Platform not supported -lssl -lcrypto Platform not supported

Link with ZLib

Links with the ZLib compression library.
See more information at http://www.zlib.net.
Default = True

Platform not supported Platform not supported Platform not supported -lz -lz

Minimum iOS version supported

Defines the minimum iOS version that your application supports.

See FireMonkey Platform Prerequisites, iOS Requirements.
Default = 5.1.0

Platform not supported Platform not supported Platform not supported -iphoneos_version_min N/A

Symbols that our runtime expects to be exported

List of symbols that must be exported because they are required at run time.

Platform not supported Platform not supported Platform not supported -exported_symbol Platform not supported

Child Pages

See Also