Command-Line Options of LINK - EXE and TLINK32.EXE
Command-Line Options of LINK - EXE and TLINK32.EXE
EXE
Descriptions of the command-line options of the MASM linker (LINK.EXE) are provided in Table 5.3.
Table 5.3: Command-line parameters of the LINK.EXE (32-bit) program
Parameter
Description
/ALIGN: number
Define the section alignment for the flat memory model. The
default value is 4096.
/BASE : {address
@filename, key}
Define the base address (loading address). For an EXE file, the
default value is 0x400000; for a DLL file, it is 0x10000000.
/COMMENT: [] COMMENT []
Define the comment placed into headers of EXE and DLL files.
/DEBUG
Create debug information for EXE and DLL files. The debug
information is placed into a PDB file.
/DEF: filename
/DEFAULTLIB: library
/DLL
/DRIVER [: {UPONLYWDM}]
/ENTRY: symbol
/EXETYPE : DYNAMIC
/EXPORT: ENTRYNAME
[=INTERNALNAME]
[,@ORDINAL [, NONAME]][,
DATA]
/FIXED [: NO]
/FORCE [: {MULTIPLE
UNRESOLVED}]
/GPSIZE: number
Define the size of general variables for MIPS and Alpha platforms.
Define the heap ( HEAP ) size in bytes. The default value is 1 MB.
/IMPLIB: filename
/INCLUDE: symbol
/LARGEADDRESSAWARE[:NO]
/LIBPATH:dir
/MAP [: filename]
/MAPINFO : { EXPORTS
FIXUPSLINES}
/MERGE: from=to
/NODEFAULTLIB[:library]
/NONENTRY
/NOLOGO
/ORDER:@filename
/OUT: filename
/PROFILE
/RELEASE
/STACK: reserve [,
commit]
/STUB: filename
/SUBSYSTEM:{NATIVE
WINDOWS CONSOLE
WINDOWSCEPOSIX}[,#[.##]]
/SWAPRUN:{CDNET}
Instruct the operating system to copy the output file into the swap
file (Windows NT).
/VERBOSE[:LIB]
/VERSION :#[.#]
/VXD
/WARN[:warninglevel]
/WS: AGGRESSIVE
In Borland C software products, starting from 1997, there were two programs for linking object files:
TLINK32.EXE (Table 5.4) and ILINK32.EXE. Command-line options of these programs were practically the
same. ILINK32.EXE is an incremental linker. It saves information about the preceding linking operations, which
allows you to considerably speed up the entire process of repeated compiling operations. Recently, the
TLINK32.EXE program was removed from the distribution set. Later in this book, I won't note the difference
between these two programs. Options marked with the plus sign (+) have appeared in the newer versions of
ILINK32.EXE, and options marked by the minus sign ( ) have been removed. In newer versions, the slash (/)
is used instead of the dash (-) to separate an option.
Table 5.4: Command-line parameters of the TLINK32.EXE program
Description
-m
Create a MAP file with information about the segments and two listings
with PUBLIC names (in alphabetic and sequential order).
-s
-M
-c
-Enn
Specify the maximum number of errors. If this number is exceeded, the linking
process stops.
-P-
Do not pack segments. This makes sense for 16-bit applications only ( -P =
allow).
-B: xxxx
-B: xxxx
This is similar to the -b option but doesn't create a tuning table. Using the b and -B keys may somewhat improve program performance.
-wxxx
This indicates possible warnings. For example, -w-stk warns you to ignore the
lack of stack segment.
-Txx
-Tpx PE image
(x: e=EXE,
d=DLL)
-ax
-r
-Vd. d
-ud. d
Place the program version into the EXE file header (+).
-o
-Ao: nnnn
-Af: nnnn
-Sc:xxxx
-s: xxxx
-Hc: xxxx
-H : xxxx
-n
-v
Include full debug information in the executable file. For the selective inclusion of
debug information in individual files, use -v+ and -v- .
-j
-L
-x
-Rr
-d
Set the DLL loading delay. It will be loaded only when the main procedure is
called (+).
-Dxxxx
-GC
Place a string or strings into the PE headerfor example, -GC Hello! (+).
-GD
-GF
-Gk
In case of error, this instructs the linker to leave the files that otherwise would be
deleted (+).
-Gl
-Gpr
-Gpd
-Gn
-GS: string
-Gz
Similar to assemblers, UNK.EXE and TLINK32.EXE can work with batch files. For example, assume that your
command line appears as follows:
link /windows:console mt.obj
Instead of this command line, you can create a text file named MTL.CMD containing the following:
/subsystem:console Mt.obj