ILINK32.EXE, the 32-bit Incremental Linker

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Utilities Index

ILINK32 links object modules (.OBJ files), library modules (.LIB files), and resources to produce executable files (.EXE, .DLL, and .BPL files). ILINK32 creates and maintains a series of linker state files that contain this information. These state files allow subsequent links to be incremental, greatly reducing the total link time. See Linker-State Files and Debug Information File.

Command-Line Syntax

ILINK32 [@<respfile>][<options>] <startup> <myobjs>, [<exefile>],^
        [<mapfile>], [<libraries>], [<deffile>], [<resfiles>]

Command-Line Elements

The linker can also use a configuration file called ILINK32.CFG for options that you'd typically type at the command line.

Element Description


A response file is an ASCII file that lists linker options and file names that you would normally type at the command line. By placing options and file names in a response file, you can save the amount of keystrokes you need to type to link your application.


Linker options that control how the linker works. For example, options specify whether to produce an .EXE, .BPL, or .DLL file. Linker options must be preceded by either a slash (/) or a hyphen (-).


An initialization module for executables or DLLs that arranges the order of the various segments of the program. Failure to link in the correct initialization module usually results in a long list of error messages telling you that certain identifiers are unresolved, or that no stack has been created.


The .OBJ files you want linked. Specify the path if the files aren't in the current directory. (The linker appends an .OBJ extension if no extension is present.) This section is also where you would put import libraries for Delphi packages (.bpi).


The name you want to be given to the executable file (.EXE, .BPL, or .DLL). If you don't specify an executable file name, ILINK32 derives the name of the executable by appending .EXE, .BPL, or .DLL to the first object file name listed. (The linker assumes or appends an .EXE extension for executable files if no extension is present. It also appends a .DLL extension for dynamic link libraries if no extension is present. Similarly, the linker appends a .BPL extension for package files if no extension is present.)


The name you want to be given to the map file. If you don't specify a name, the map file name is the same as the .EXE file (but with the .MAP extension). (The linker appends a .MAP extension if you do not specify an extension.)


The library files you want to be included at link time. Do not use commas to separate the libraries listed. If a file is not in the current directory or the search path (see the /L option), then you must include the path in the link statement. (The linker appends a .LIB extension if no extension is present.) The order in which you list the libraries is very important; be sure to use the order defined in this list:

  1. CodeGuard libraries (if needed).
  2. Any of your own user libraries (note that if a function is defined more than once, the linker uses the first definition encountered).
  3. IMPORT32.LIB or IMPORT64.LIB (if you are creating an executable that uses the Windows API).
  4. Math libraries.
  5. Run-time libraries.


The module definition file for a Windows executable. If you don't specify a module definition (.DEF) file and you have used the /Twd or /Twe option, the linker creates an application based on default settings. (The linker appends a .DEF extension if no extension is present.)


A list of .RES files (compiled resource files) to bind to the executable. (The linker appends a .RES extension if no extension is present.)

To display the command-line help, enter:


Command-Line Options

ILINK32.EXE command-line options are case-sensitive.

ILINK32.EXE supports the command-line options listed in the following table:

Linker Options

Option Description


Uses the response file <respfile>.


Specifies file alignment (for backward-compatibility switch, use /Af).


Specifies file alignment; set nnnn in hex or decimal. nnnn must be a power of 2.
Default is 0x200 = 512 byte boundaries.


Specifies object alignment; set nnnn in hex or decimal. nnnn must be a power of 2.
Default is 0x1000 = 4096 byte boundaries.


Builds a 32-bit Windows application.


Builds a 32-bit Windows device driver.


Builds a 32-bit Windows console application.


Specifies the image base address and removes the relocation table.


Specifies the image base address, and preserves DLL relocation table. Successive objects are aligned on 64K linear address boundaries. Improves load-time and run-time performance. Recommended for producing DLLs.
Default is Off.


Refreshes the linker state files . Erases all linker state files before each link; then recreates the files and continues with the link.


Treats case as significant in public and external symbols.
Default is On.


Delay-loads a DLL. The specified DLL is not loaded or initialized until an entry point in the DLL is actually called.


Saves the specified description in the PE image.


Specifies the max. number of errors.


Inserts a comment string into the image directly after the object table in the PE file header. You can specify more than one string.
Default is Off.


Generates a Delphi-compatible RC file (DRC file).
Default is Off.


Sets image flags. The xxxx flags are:

  • -GF SWAPNET copies the image to a local swap file and runs it from there if the image resides on a network drive.
  • -GF SWAPCD copies the image to a local swap file and runs it if the image resides on removable media (CD, zip drive).
  • -GF UNIPROCESSOR prevents the application from running on a multiprocessor system.
  • -GF LARGEADDRESSAWARE tells the OS that the application understands addresses larger than 4GB.
  • -GF AGGRESSIVE aggressively trims the working set of an application when the application is idle (suited for screen savers and other processes that you want to stay out of the way of main line processes).


Keeps output files on error.
Default is Off.


Generates a .LIB file.


Generates design-time-only package. Default is: the package works at both design time and run time.


Generates run-time-only package. Default is: the package works at both design time and run time.


Do not generate linker state files (disable incremental linking). Subsequent links will take just as long as the first one. Default is Off.


Set section flags. Adds the specified flags to the existing flags for a given section, but cannot remove default flags from a section. Section flags are:
E = Executable
C = Contains code
I = Contains initialized data
R = Section is readable
W = Section is writable
S = Section is shared
D = Section is discardable
K = Section must not be cached
P = Section must not be paged



This switch makes the RSRC section writable.


Calculate checksum of target and insert result in PE header. Used for NT Kernel mode drivers and system DLLs.
Default is Off.


Specifies application heap reserve size in hex or decimal. Minimum value is 0. This switch overrides the HEAPSIZE setting in a module definition file.
Default is 1 MB (0x1000000).


Specifies application heap commit size.


Specifies the directory for intermediate output files. Directs linker state files, but the map debug file and TDS debug file are saved in the same directory as the output image, unless otherwise specified for the MAP file.


Specifies object search paths.


 ILINK32 /jc:\myobjs;.\objs splash ^
      .\common\logo,,,utils logolib

This command directs the linker to first search the current directory for SPLASH.OBJ. If the file is not found in the current directory, the linker then searches the C:\MYOBJS directory, and then the .\OBJs directory. However, the linker does not use the object search paths to find the file LOGO.OBJ because an explicit path was given for this file.


Specifies the library search path to use if no explicit path is given for the LIB file and the linker cannot find the LIB file in the current directory.

 ILINK32 /Lc:\mylibs;.\libs splash ^
     .\common\logo,,,utils logolib

directs the linker to first search the current directory for SPLASH.LIB. If the file is not found in the current directory, the linker then searches the C:\MYLIBS directory, and then the .\LIBs directory. However, the linker does not use the library search paths to find the file LOGO.LIB because an explicit path was given for this file.


Prints the mangled C++ identifiers in the map file, not the full name.


The segment listing has a line for each segment, showing the segment starting address, segment length, segment name, and the segment class. The public symbols are broken down into two lists, the first showing the symbols sorted alphabetically, the second showing the symbols in increasing address order. Symbols with absolute addresses are tagged Abs. A list of public symbols is useful when debugging. Many debuggers use public symbols, which lets you refer to symbolic addresses while debugging.


Suppresses command line banner.


Verbose linking. Default is Off.


Replaces resources.


Specifies application stack reserve size.


Specifies application stack commit size.


Produces a detailed map file of segments by adding details such as group and module information to the default map file produced by the linker.


Targets a 32-bit Windows DLL file.


Targets a 32-bit Windows EXE file.


Generates a package.


Displays time spent on link.


Generates a TDS debug file.


Turns all warnings on.


Disables the warning:
".EXE module built with a .DLL or BPL extension."


Disables the warning:
"Duplicate symbol in library."


Disables the warning:
"Duplicate symbol."


Enables the warning:
"Attempt to export non-public symbol."


Disables the warning:
"Creating a package without any units."


Enables the warning:
"Unable to perform incremental link - performing full link."


Disables the warning:
"Stripping relocations from a DLL may cause it to malfunction."


Disables the warning:
"Section not found."


Disables the warning:
"Unable to load DLL."


Suppresses creation of a MAP file.


Default map file of segments (no linker switch).

By default, the linker generates a map file containing general segment information that includes:

  • A list of segments with their names.
  • The program start address and offset.
  • The class: CODE, DATA, BSS (uninitialized), or TLS (thread local storage).
  • Any warning or error messages produced during the link.

Linker Response Files

You can use response files with the command-line linker to specify linker options.

Response files are ASCII files that list linker options and file names that you would normally type at the command line. Response files allow you longer command lines than most operating systems support, plus you don't have to continually type the same information. Response files can include the same information as configuration files, but they also support the inclusion of file names.

Unlike the command line, a response file can be several lines long. To specify an added line, end a line with a plus character (+) and continue the command on the next line. Note that if a line ends with an option that uses the plus to turn it on (such as /v+), the + is not treated as a line continuation character (to continue the line, use /v+ +).

If you separate command-line components (such as .OBJ files from .LIB files) by lines in a response file, you must leave out the comma used to separate them on the command line.

For example:

/c c0ws+
myprog,myexe +
mymap +
mylib cws

leaves out the commas you'd have to type if you put the information on the command line:

ILINK32 /c c0ws myprog,myexe,mymap,mylib cws

To use response files:

  1. Type the command-line options and file names into an ASCII text file and save the file. Response files typically have an .RSP extension.
  2. Type:
ILINK32 @[<path>]<RESFILE.RSP>
where <RESFILE.RSP> is the name of your response file.

You can specify more than one responses file, as follows:

ilink32 /c @listobjs.rsp,myexe,mymap,@listlibs.rsp

Note: You can add comments to response files using semicolons; the linker ignores any text on a line that follows a semicolon.

Module Definition Files

The module definition file is an ASCII text file that provides information to ILINK32 about the contents and system requirements of a Windows application. You can create a module definition file using IMPDEF.EXE, and you can create import libraries from module definition files using IMPLIB.EXE.

If no module definition file is specified, the following defaults are assumed:

DATA        PRELOAD MOVEABLE MULTIPLE  (for applications)
            PRELOAD MOVEABLE SINGLE    (for DLLs)
HEAPSIZE    4096
STACKSIZE   1048576

To change an application's attributes from these defaults, you need to create a module definition file.

If you delete the EXETYPE statement, the linker can determine what kind of executable you want to produce from the options you supply on the command line.

You can include an import library to substitute for the IMPORTS section of the module definition.

You can use the __declspec(dllexport) or _export keywords in the definitions of export functions in your C and C++ source code to remove the need for an EXPORTS section. Note, however, that if __declspec(dllexport) or _export is used to export a function, that function is exported by name rather than by ordinal. Please also note that __declspec(dllexport) is the preferred method of export.

For more information, see Module Definition Files.

Linker-State Files

The four linker-state files have the following file extensions:

  • .ILC (linker code file)
  • .ILD (linker data file)
  • .ILF (linker other file)
  • .ILS (linker symbols file)

These four files are required for incremental linking.

You can control the linker state files on the Project > Options > C++ Linker page, as follows:

  • To disable the creation of the linker state files, check the Disable incremental linking (-Gn) option.
  • To clear the current linker state files and create new ones in the next link operation, check the Clear state before linking (-C) option.

Debug Information File

If you include debug information in your final linked executable, ILINK32 will always store the debug information in a separate TDS debug file, named <project>.tds by default. The debugger should be able to read this debugger-information file. ILINK32 will always create this file. If you do not have the -v (or /v) linker switch set, the debug symbol file is marked as invalid.

DCC32.exe (the Delphi compiler) has a command line switch -VT for generating debug symbol files. You can also specify that the Delphi compiler is to generate debug symbol files by enabling Place debug information in separate TDS file on the Linking page of Project Options.

Using ILINK32 with BCC32.EXE

You can pass options and files to ILINK32 through the command-line compiler (BCC32.EXE) by typing file names on the command line with explicit .OBJ and .LIB extensions. For example, this command:

BCC32 mainfile.obj sub1.obj mylib.lib

links MAINFILE.OBJ, SUB1.OBJ, and MYLIB.LIB to produce the executable MAINFILE.EXE.

Note: By default, BCC32 starts ILINK32 with the files C0W32.OBJ, CW32.LIB, and IMPORT32.LIB (initialization module, run-time library, and Windows import library). In addition, both the Delphi and C++ compilers always pass the linkers the /c (case-sensitive link) option.

See Also