This documentation is archived and is not being maintained.

Linker Options

LINK is a 32-bit tool that links Common Object File Format (COFF) object files and libraries to create a 32-bit executable (.exe) file or dynamic-link library (DLL).

The table below is a comprehensive list of options for LINK.exe. This section also includes information on:

Linker options specified on the command line are not case sensitive: /base and /BASE mean the same thing.

You can specify some linker options via the comment pragma.

Option Purpose
@ Specifies a response file
/ALIGN Specifies the alignment of each section
/ALLOWBIND Specifies that a DLL cannot be bound
/ASSEMBLYDEBUG Adds the DebuggableAttribute to a managed image.
/ASSEMBLYLINKRESOURCE Create a link to a managed resource.
/ASSEMBLYMODULE Specifies that a Microsoft Intermediate Language (MSIL) module should be imported into the assembly
/ASSEMBLYRESOURCE Embeds a managed resource file to an assembly
/BASE Sets a base address for the program
/DEBUG Creates debugging information
/DEF Passes a module-definition (.def) file to the linker
/DEFAULTLIB Searches the specified library when resolving external references
/DELAY Controls the delayed loading of DLLs
/DELAYLOAD Causes the delayed loading of the specified DLL
/DELAYSIGN Partially sign an assembly.
/DLL Builds a DLL
/DRIVER Creates a Windows NT kernel mode driver
/ENTRY Sets the starting address
/EXETYPE Builds a virtual device driver
/EXPORT Exports a function
/FIXED Creates a program that can be loaded only at its preferred base address
/FORCE Forces a link to complete in spite of unresolved or symbols defined more than once
/HEAP Sets the size of the heap in bytes
/IDLOUT Specifies the name of the .idl file and other MIDL output files
/IGNOREIDL Prevents processing attribute information into an .idl file
/IMPLIB Overrides the default import library name
/INCLUDE Forces symbol references
/INCREMENTAL Controls incremental linking
/KEYCONTAINER Specify a key container to sign an assembly.
/KEYFILE Specify key or key pair to sign an assembly.
/LARGEADDRESSAWARE Tells the compiler that the application supports addresses larger than two gigabytes
/LIBPATH Allows the user to override the environmental library path
/LTCG Specifies link-time code generation
/MACHINE Specifies the target platform
/MAP Creates a mapfile
/MAPINFO Includes the specified information in the mapfile
/MERGE Combines sections
/MIDL Specifies MIDL command line options
/NOASSEMBLY Suppresses the creation of a .NET Framework assembly
/NODEFAULTLIB Ignores all (or specified) default libraries when resolving external references
/NOENTRY Creates a resource-only DLL
/NOLOGO Suppresses startup banner
/OPT Controls LINK optimizations
/ORDER Places COMDATs into the image in a predetermined order
/OUT Specifies the output file name
/PDB Creates a program database (PDB) file
/PDBSTRIPPED Creates a program database (PDB) file with no private symbols
/RELEASE Sets the Checksum in the .exe header
/SAFESEH Specify that the image will contain a table of safe exception handlers.
/SECTION Overrides the attributes of a section
/STACK Sets the size of the stack in bytes
/STUB Attaches an MS-DOS stub program to a Win32 program
/SUBSYSTEM Tells the operating system how to run the .exe file
/SWAPRUN Tells the operating system to copy the linker output to a swap file before running it
/TLBID Allows you to specify the resource ID of the linker-generated type library
/TLBOUT Specifies the name of the .tlb file and other MIDL output files
/TSAWARE Creates an application that is specifically designed to run under Terminal Server
/VERBOSE Prints linker progress messages
/VERSION Assigns a version number
/VXD Creates a virtual device driver (VxD)
/WS Aggressively trims process memory

For related information, see Compiler-Controlled LINK Options.

See Also

C/C++ Building Reference | Setting Linker Options | FAQ: Building Your Program