Linker Options
Collapse the table of content
Expand the table of content

Linker Options


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

The following table lists options for LINK.exe. For more information about LINK, see:

On the command line, linker options are not case-sensitive—for example, /base and /BASE mean the same thing. For details on how to specify each option on the command line or in Visual Studio, see the documentation for that option.

You can use the comment pragma to specify some linker options.




Specifies a response file.


Specifies the alignment of each section.


Specifies that a DLL cannot be bound.


Specifies behavior for manifest lookup.


Specifies whether the app must run within an appcontainer process environment.


Adds the DebuggableAttribute to a managed image.


Creates a link to a managed resource.


Specifies that a Microsoft intermediate language (MSIL) module should be imported into the assembly.


Embeds a managed resource file in an assembly.


Sets a base address for the program.


Sets number of cl.exe threads to use for optimization and code generation when link-time code generation is specified.


Sets the type (IJW, pure, or safe) of a CLR image.


Preserves the last error code of functions that are called through the P/Invoke mechanism.


Specifies the threading attribute to apply to the entry point of your CLR program.


Specifies whether the linker will apply the SuppressUnmanagedCodeSecurity attribute to linker-generated PInvoke stubs that call from managed code into native DLLs.


Creates debugging information.


Specifies which data to include in debugging information.


Passes a module-definition (.def) file to the linker.


Searches the specified library when external references are resolved.


Controls the delayed loading of DLLs.


Causes the delayed loading of the specified DLL.


Partially signs an assembly.


Builds a DLL.


Creates a kernel mode driver.


Specifies whether to generate an executable image that can be randomly rebased at load time by using the address space layout randomization (ASLR) feature.


Sets the starting address.


Reports internal linker errors to Microsoft.


Exports a function.


Creates a program that can be loaded only at its preferred base address.


Forces a link to complete even with unresolved symbols or symbols defined more than once.


Creates an image that can be hot patched.


Both of these options specify generation of a .pgd file by the linker to support profile-guided optimization (PGO). /GENPROFILE and /FASTGENPROFILE use different default parameters.


Enables Control Flow Guard protection.


Sets the size of the heap, in bytes.


Specifies support for high-entropy 64-bit address space layout randomization (ASLR).


Specifies the name of the .idl file and other MIDL output files.


Suppresses output of specified linker warnings.


Prevents the processing of attribute information into an .idl file.


Overrides the default import library name.


Forces symbol references.


Controls incremental linking.


Specifies that the module requires a signature check at load time.


Specifies a key container to sign an assembly.


Specifies a key or key pair to sign an assembly.


Tells the compiler that the application supports addresses larger than two gigabytes


Specifies a path to search before the environmental library path.


Specifies link-time code generation.


Specifies the target platform.


Creates a side-by-side manifest file and optionally embeds it in the binary.


Specifies a <dependentAssembly> section in the manifest file.


Changes the default name of the manifest file.


Specifies a manifest input file for the linker to process and embed in the binary. You can use this option multiple times to specify more than one manifest input file.


Specifies whether User Account Control (UAC) information is embedded in the program manifest.


Creates a mapfile.


Includes the specified information in the mapfile.


Combines sections.


Specifies MIDL command-line options.


Suppresses the creation of a .NET Framework assembly.


Ignores all (or the specified) default libraries when external references are resolved.


Creates a resource-only DLL.


Suppresses the startup banner.


Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature.


Controls LINK optimizations.


Places COMDATs into the image in a predetermined order.


Specifies the output file name.


Creates a program database (PDB) file.


Uses an alternate location to save a PDB file.


Creates a program database (PDB) file that has no private symbols.


Specifies a .pgd file for profile-guided optimizations.


Produces an output file that can be used with the Performance Tools profiler.


Sets the Checksum in the .exe header.


Specifies that the image will contain a table of safe exception handlers.


Overrides the attributes of a section.


Sets the size of the stack in bytes.


Attaches an MS-DOS stub program to a Win32 program.


Tells the operating system how to run the .exe file.


Tells the operating system to copy the linker output to a swap file before it is run.


Specifies the resource ID of the linker-generated type library.


Specifies the name of the .tlb file and other MIDL output files.


Creates an application that is designed specifically to run under Terminal Server.


Prints linker progress messages.


Assigns a version number.


Enables generation of a Windows Runtime Metadata file.


Specifies the file name for the Windows Runtime Metadata (winmd) output file that's generated by the /WINMD linker option.


Specifies a key or key pair to sign a Windows Runtime Metadata file.


Specifies a key container to sign a Windows Metadata file.


Partially signs a Windows Runtime Metadata (.winmd) file by placing the public key in the winmd file.


Treats linker warnings as errors.

For more information, see Compiler-Controlled LINK Options.

© 2015 Microsoft