Technical Details About ILINK32 and ILINK64

From RAD Studio
Jump to: navigation, search

Go Up to C++ Linkers


For information on using ILINK32 and ILINK64 on the command line, please see the Using ILINK32 and ILINK64 on the Command Line page.

ILINK32

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.

Module Definition Files

The module definition file is a 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:

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

To change the attributes of an application 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.

ILINK64

ILINK64 is the linker for C++ 64-bit Windows applications. Command syntax and usage for ILINK64 are the same as those of ILINK32. The main differences between the two C++ linkers for Windows are:

  • ILINK32 links .obj and .lib files into a 32-bit Windows executable or .dll.
  • ILLINK64 links .o and .a files into a 64-bit Windows executable or .dll.

With these main differences, you use the two linkers in the same ways.

Handling ILINK64 Errors

BCC64 Errors and Warnings describes handling the following error from ILINK64, the C++ linker for 64-bit Windows:

 Public symbol 'x' defined in both module A and B

Some projects have a large amount of debugging or other data that can cause errors in the linker using its default settings. For information on how to handle this type of error, see Handling Linker Out of Memory Errors or learn more about the Split DWARF feature that helps you reduce the linker memory usage.

See Also