Share via


Linker Reference

OverviewHow Do IFAQDetails

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).

Following is a comprehensive list of options for LINK.EXE. For information on how to specify an option, see Set Linker Options.

This section also includes information on Compiler-Controlled LINK Options, LINK Input Files, and LINK Output.

Option Action
/ALIGN:number Specifies the alignment of each section
/BASE:{address | @filename,key} Sets a base address for the program
/COMMENT:["]comment["] Inserts a comment string into header
/DEBUG Creates debugging information
/DEBUGTYPE:CV
/DEBUGTYPE:COFF
/DEBUGTYPE:BOTH
Creates particular formats of debugging information
/DEF:filename Passes a module-definition (.DEF) file to the linker
/DEFAULTLIB:library Searches specified library when resolving external references
/DELAY Controls the delayed loading of DLLs
/DELAYLOAD Causes the delayed loading of the specified DLL
/DLL Builds a DLL
/DRIVER[:UPONLY] Creates a Windows NT kernel mode driver
/ENTRY:function Sets the starting address
/EXETYPE:DYNAMIC Builds a virtual device driver
/EXPORT Exports a function
/FIXED[:NO] Creates a program that can be loaded only at its preferred base address
/FORCE[:{MULTIPLE|UNRESOLVED}] Forces link to complete in spite of unresolved or multiply defined symbols
/GPSIZE:# Specifies the size of communal variables for MIPS and Alpha platforms
/HEAP:reserve[,commit] Sets the size of the heap in bytes
/IMPLIB:filename Overrides the default import library name
/INCLUDE:symbol Forces symbol references
/INCREMENTAL:{YES|NO} Controls incremental linking
/LARGEADDRESSAWARE Tells the compiler that the application supports addresses larger than two gigabytes.
/LIBPATH:path Allows the user to override the environmental library path
/LINK50COMPAT Generates import libraries in Visual C++ Version 5.0 format
/MACHINE:{IX86|ALPHA|ARM|MIPS|MIPSR41XX|PPC|SH3|SH4} Specifies the target platform
/MAP Creates a map file
/MAPINFO:{EXPORTS|FIXUPS|LINES} Includes the specified information in the map file
/MERGE:from=to Combines sections
/NODEFAULTLIB[:library] Ignores all (or specified) default libraries when resolving external references
/NOENTRY Creates a resource-only DLL
/NOLOGO Suppresses startup banner
/OPT:{REF|NOREF|ICF[,iterations]|NOICF} Controls LINK optimizations
/ORDER:@filename Places COMDATs into the image in a predetermined order
/OUT:filename Specifies the output file name
/PDB:filename Creates a program database (.PDB) file
/PDBTYPE:{con[solidate]|sept[ypes]} Specifies where to store the Program Database (PDB) debug type information.
/PROFILE Enables profiling (creates a mapfile)
/RELEASE Sets the checksum in the .EXE header
/SECTION:name,attributes Overrides the attributes of a section
/STACK:reserve[,commit] Sets the size of the stack in bytes
/STUB:filename Attaches an MS-DOS stub program to a Win32 program
/SUBSYSTEM:{CONSOLE|WINDOWS|NATIVE|POSIX|WINDOWSCE} [,major[.minor] ] Tells the operating system how to run the .EXE file
/SWAPRUN:{NET|CD} Tells the operating system to copy the linker output to a swap file before running it
/VERBOSE[:LIB] Prints linker progress messages
/VERSION:major[.minor] Assigns a version number
/VXD Creates a virtual device driver (VxD)
/WARN[:level] Specifies warning level
/WS:AGGRESSIVE Aggressively trim process memory

For related information, see Compiler-Controlled LINK Options.