From Appmethod Topics
Jump to: navigation, search

Go Up to C++ Linkers

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 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 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 Object Pascal compiler) has a command line switch -VT for generating debug symbol files. You can also specify that the Object Pascal compiler is to generate debug symbol files by enabling Place debug information in separate TDS file on the Linking page of Project Options.

See Also