LINK.EXE Options

Each option begins with a switch whose first character is a forward slash or hyphen. The standard practice in these notes is to use the forward slash in all references to LINK.EXE options, leaving it as understood that the hyphen is equivalent unless otherwise stated.

A question mark is permitted between the forward slash or hyphen and the ordinary characters of the switch. Only very rarely is this any more than a curiosity. All references to LINK.EXE options should be understood as applying equally to the form with a question mark inserted, unless otherwise stated.

Arguments

The switch may be followed by a colon to introduce either a single argument or a list of arguments separated by commas. Each argument in the list may decompose into a property and a value, separated by an equals sign.

Thus, there is a first syntax

switch[:argument]

in which switch begins with a forward slash or hyphen and contains no colon, and argument consists of everything after the first colon (if any) in the option.

In the second syntax

switch[:argument[[,argument]...]]

each argument now contains no comma, and may have the form

[property=]value

where property contains no equals sign and value consists of everything after the first equals sign (if any) in the argument.

In descriptions of individual options, the first syntax is indicated by saying that the argument consists of everything after the colon. Otherwise, the multiple-argument syntax is meant, even if only one argument is permitted.

Case

Except where noted to the contrary, text in options is case-insensitive, both for the switches and for any keywords that are permitted among the arguments.

Numbers

Also unless noted otherwise, numbers in arguments are decimal, or in C-language hexadecimal or octal notation. They are not permitted either a sign prefix or trailing non-numerical characters, and are evaluated as unsigned integers truncated to 32 bits.

Errors and Warnings

Two error conditions apply so generally that they will not even be mentioned elsewhere. First, it is a fatal error (LNK1146) if an option ends with its first colon. The one exception is that LIB explicitly disregards a trailing colon for the /def option. Second, it is a fatal error (LNK1117) if the initial forward slash or hyphen is followed immediately by a colon.

Some more conditions for errors and warnings are so typical that they are left as understood unless an exception is explicitly noted.

Where an option requires an argument (or arguments), failure to provide any (or enough) is typically a fatal error (LNK1146). Note that this applies to cases where the required arguments in the multiple-argument syntax are empty, as when a comma immediately follows the colon or another comma.

Where an option permits some number of arguments, provision of too many typically produces just a warning (LNK4056) that extra arguments are ignored.

The property=value syntax is meaningful to relatively few options, but not all disallow it explicitly. Where an argument is not shown as supporting this syntax, use of it is typically a fatal error (LNK1117). If the syntax is valid but the property and equals sign are ignored, this will be noted as a curiosity about the argument.