14.3 LINK Output Files

LINK can create executable files for DOS or Windows. The kind of file produced is determined by the way the source code is compiled and the information supplied to LINK. LINK's output is either an executable file or a DLL. For simplicity, this chapter sometimes refers to this output as the “program” or “main output.” LINK creates the appropriate file according to the following rules:

If a .DEF file is specified, LINK creates a segmented executable file. The type is determined by the EXETYPE and LIBRARY statements.

If a .DEF file is not specified, LINK creates a DOS program.

If an overlay number is specifed in a SEGMENTS or FUNCTIONS statement, LINK creates an overlaid DOS program. This overrides a conflicting .DEF file specification.

If /DYNAMIC or /OLDOVERLAY is specified, or if parentheses are used in the objects field, LINK creates an overlaid DOS program. This overrides a conflicting .DEF file specification.

If an object file or library module contains an export definition (an EXPDEF record), LINK creates a segmented executable file. This overrides an overlay specification. The __export keyword creates an EXPDEF record in a C program. Microsoft C libraries for protect mode contain EXPDEF records, so linking with a protect-mode default library creates a segmented executable file.

If an import library is specified, LINK creates a segmented executable file.

Summary: Map files list the segments and symbols in a program.

LINK can also create a “map” file, which lists the segments in the executable file and can list additional information. The /LINE and /MAP options control the content of the map file.

Summary: LINK produces other files when certain options are used.

Other options tell LINK to create other kinds of output files. LINK produces a .COM file instead of an .EXE file when the /TINY option is specified. The combination of /CO and /TINY puts debugging information into a .DBG file. A Quick library results when the /Q option is specified. For more information on these and other options, see “LINK Options”.