### Set Linker Options in the ILINK Environment Variable

Store frequently used options in the ILINK environment variable. This method is useful if you repeat the same command-line options every time you link. You cannot specify filenames in the environment variable, only linker options.

The ILINK environment variable can be set in the following ways:

- from the command line
- in a command (.cmd) file.

> Note: If the ILINK environment variable is set on the command line or by running a command file, the options will only be in effect for the current session (until you reboot your computer).

- in the autoexec.bat file
- in the startup.cmd file
- In Windows NT, it can be set in the System window: click on Set to add a new item to the list of User Environment Variables.

> Note: If the ILINK environment variable is set in the autoexec.bat file or the System window, the options are set when you reboot, and remain in effect every time you use the linker unless you override them using a .cmd file or by specifying options on the command line.

In the following example, options on the command line override options in the environment variable.

    SET ILINK=/DLL /DE

    ILINK test

    ILINK /NODEF /NODEB prog.obj

The first command sets the environment variable to the options /DLL and /DEBUG.

The second command links the file`test.obj`, using the options specified in the environment variable, to produce`test.dll`.

The last command links the file `prog.obj` to produce `prog.dll`, using the /NODEFAULTLIBRARYSEARCH option, in addition to the /DLL option. The /NODEBUG option on the command line overrides the /DEBUG option in the environment variable, and the linker links without the /DEBUG option.

Set Linker Options

Application Runtime Environment Variables
Environment Variables for Compiling