digitalmars.com                        
Last update Sun Mar 4 11:58:07 2018

OPTLINK Switches

This page describes the effect of each option switch recognized by OPTLINK.

Number Representation

Several option switches require numeric values. These are indicated by the suffix ":n" or "= n" within the syntax description. Separate the numeric value from the option by the appropriate colon or equals sign.

The numeric base defaults to decimal. If the value begins with a 0, its base is taken to be octal, and if it begins with 0x or 0X, hexadecimal is assumed. That is, the standard C language base convention is assumed by OPTLINK.

Switch Overview

The following is an overview of OPTLINK switches. Either a "-" (hyphen) or a "/" (slash) must precede an option switch. Further descriptions of the option switches and their possible opposites are in "Using OPTLINK Option Switches" below.

Option Switch Purpose
/ALIGNMENT Segment alignment size
/BASE Set the base address of the executable image
/BINARY Generates a .sys file
/BYORDINAL Export by ordinal
/CHECKSUM Parsed and ignored
/CODEVIEW Outputs CodeView debugger information
/COMDEFSEARCH Specifies whether an undefined COMDEF causes a library search
/CPARMAXALLOC Sets .exe maximum bytes to occupy in DOS RAM
/CVVERSION Preserves OPTLINK's CodeView compatibility.
/DEBUG Controls all debug information for files that follow
/DEBUGFILES Controls debug information for specific files only
/DEBUGLINES Controls debug line number information for files that follow
/DEBUGLOCALS Controls debug local symbols information for files that follow
/DEBUGMODULES Controls debug information for specific modules only
/DEBUGPUBLICS Controls debug public symbols information for files that follow
/DEBUGTYPES Controls debug type information for files that follow
/DEFAULTLIBRARYSEARCH Searches default libraries named in .obj files
/DELEXECUTABLE Deletes .exe upon encountering any linking errors
/DETAILEDMAP Produces detailed map reports.
/DOSSEG Controls segment sequence
/ECHOINDIRECT Controls echoing of indirect response file input
/EMSMAXSIZE Sets maximum EMS size
/EMSPAGEFRAMEIO Gives permission to use EMS page frame for I/O
/EMSUSE40 Allow LIM 4.0 adherence
/ERRORFLAG Controls error flag in segmented executable header
/EXEPACK Performs run-length encoding (packs executable)
/EXETYPE Specifies the target operating system
/FARCALLTRANSLATION Converts intra-segment far calls to near
/FIXDS Identical to the .def directive FIXDS
/FIXED Fixes the executable image in memory
/GROUPASSOCIATION Controls GROUP information found in .obj
/GROUPSTACK Controls stack definition in .exe file header
/HEAP Sets the size of the local heap
/HELP Displays switch options
/IGNORECASE Preserves and ignores case of all symbols
/IMPDEF Generate .din file from EXPORTS section of .def file
/IMPLIB Create .lib import library for .dll
/INFORMATION Display status information throughout the link process
/LINENUMBERS Outputs line number information in .map file
/LOWERCASE Converts all symbols to lowercase
/MACHINE Specifies the type of the target machine
/MAP Controls information content in .map file
/NOLOGO Suppresses OPTLINK's sign-on copyright message
/NONAMES Eliminates name text for ordinal exports
/NULLDOSSEG Outputs null bytes in the _TEXT segment
/ONERROR Same as /DELEXECUTABLE
/PACKCODE Combines segments of class CODE
/PACKDATA Combines data segments where possible
/PACKFUNCTIONS Performs "smart-linking" on code and data
/PACKIFNOSEGMENTS Forces /PACKCODE on when no SEGMENTS directive
/PACKSIZE Packs size for /PACKCODE and /PACKDATA
/PAGESIZE Set /IMPLIB page size
/PAUSE Provides time to swap disks while creating output
/PMTYPE Specifies type of segmented output
/PROMPT Specifies whether OPTLINK will prompt for more options
/RC Like .def directive RC
/RELOCATIONCHECK Ensures no relocation overlaps have occurred
/REORDERSEGMENTS Performs segment reordering
/SCANLIB Scans the LIB environment variable
/SCANLINK Scans the LINK environment variable
/SILENT Does not display linking status information
/STACK Defines stack segment and/ or its size.
/STUB Adds a stub file to the executable
/SUBSYSTEM Sets Win32 subsyste
/TINY Generates a .com file
/UPPERCASE Converts all symbols to upper case
/VERSION Adds a version number to the executable
/WARNDUPS Warns of duplicate public symbols in .lib
/WINPACK Build compressed output utilizing decompressing loader
/XMSMAXSIZE Sets maximum XMS size
/XNOIGNORECASE Treats EXPORT and IMPORT symbols as case significant
/XREF Controls information content in .map file
/XUPPERCASE Forces EXPORT and IMPORT symbols to upper case
/? Like /HELP

Unsupported Microsoft LINK switches

OPTLINK does not recognize the following Microsoft LINK switches:

/DSALLOC
/DYNAMIC
/HIGH
/OLDOVERLAY
/OVERLAYINTERRUPT
/QUICKLIBRARY
/r

OPTLINK parses and ignores the following Microsoft LINK switches:

/BATCH
/CHECKABORT
/CHECKEXE
/NOEXTDICTIONARY
/PADCODE
/PADDATA
/SEGMENTS
/WARNFIXUP

Using OPTLINK Option Switches

This section describes the OPTLINK switches. By default, OPTLINK recognizes these switches.

While this section supplies the full name of each option switch, you need to supply only enough characters to uniquely identify it. These option switches are not case significant. Either a "-" or a "/" must precede an option switch. "Default" shows OPTLINK's assumptions before encountering any option switch or directive.

/ALIGNMENT:n

Default :       /ALIGNMENT:16 (Win32 default is 512)

In the segmented .exe format, the ALIGNMENT value determines maximum file size because segments and resources are referenced by a 16-bit page number. Page size is set by ALIGNMENT, so if n is left at its default value of 16, the maximum file size will be 16* 65535 bytes, or 1 megabyte. To increase the file size limit, increase n. The value specified must be a power of 2.

When generating a conventional MS-DOS .exe files, this switch causes the .exe file header to be rounded up to the specified page size. n is the file header alignment size in bytes. Defaulting to 16 allows for the smallest .exe file size. Other linkers use a page size of 512, causing unnecessarily large .exe files. Some .exe post-processors (notably EXE2BIN) may require you to retain the 512-byte header size. The value specified must be a power of 2.

/BASE:nn

Sets the base address of the executable image to the hexadecimal value nn.

/BINARY[:n]

Causes OPTLINK to generate a .sys file instead of an .exe file. The value n is the lowest address generated in the .sys file. If you want your .sys file to start with code at 8000H, use "/BI:0x8000" to define the lowest address. Defaults to 0 when not supplied.

/BYORDINAL

For 32-bit output, /BYORDINAL causes OPTLINK to export symbols by ordinal.

For 16-bit output, causes OPTLINK to move the name text for every exported symbol, designated by __export in source code, from the RESIDENT name table (which requires Windows memory) to the NONRESIDENT name table. Effectively, this option reduces memory requirements and load times for 16-bit programs. It also allows you to export more symbols from 16-bit .exe and .dll files, since the file format allows a maximum .exe header size of 64Kb, and RESIDENT names are part of that header. The NONRESIDENT table can be 65,535 bytes in size.

Use /BYORDINAL with /IMPDEF, /IMPLIB, and /NONAMES to optimize the size and speed of your 16-bit code. However, any additional modifications to entry points can cause ordinal changes that effectively necessitate rebuilding the entire application. To minimize the impact of this problem:

/[NO]CHECKSUM

Default :       /NOCHECKSUM
Parsed and ignored.

/[NO]CODEVIEW[:n]

Default :       /NOCODEVIEW
Controls whether OPTLINK should include CodeView information within the output .exe file. CodeView expects such information to be present within applicable .obj files being linked. OPTLINK includes any available CodeView information for all object modules unless the options /DEBUG, /DEBUGCOVERAGES, /DEBUGFILES, /DEBUGLINES, /DEBUGLOCALS, /DEBUGMODULES, /DEBUGPUBLICS, or /DEBUGTYPES are supplied.

n specifies the CodeView major version format desired (applicable only with /CODEVIEW). For CodeView 2.x, enter 2, for CodeView 3.x, enter 3, and for CodeView 4.x, enter 4. For /CODEVIEW without a number, OPTLINK uses the default. OPTLINK automatically performs the CVPACK step when n is 4.

/[NO]COMDEFSEARCH

Default :       /NOCOMDEFSEARCH
Specifies whether OPTLINK peforms a library search if it encounters an undefined COMDEF record.

/CPARMAXALLOC:n

Default :       /CPARMAXALLOC:0xFFFF
Only valid when generating MS-DOS .exe files. This switch sets the maximum number, n, of 16-byte paragraphs needed by a DOS program to occupy when loaded in memory. This functionality is useful for reserving memory needed for other programs.

If the program requires more space, OPTLINK sets the allowable RAM usage to the actual amount required by the program. If you do not use this switch, OPTLINK sets the RAM requirement to its maximum possible value, causing the program to use all available RAM at run-time. Acceptable values are 1 to 65,535.

/CVVERSION:n

Default :       /CVVERSION:4
Enhance the Microsoft LINK drop-in replacement capability of OPTLINK. Your existing make files or other Microsoft LINK command sets may assume a different version of CodeView. By placing this switch in optlinks. cfg, you avoid making any changes to established make files.

n specifies the CodeView major version format desired (applicable only when using /CODEVIEW). For CodeView 2.x, enter 2, for CodeView 3.x, enter 3, and for CodeView 4.x, enter 4. When you enter /CODEVIEW without a number, OPTLINK uses the default. OPTLINK automatically performs the CVPACK step when you use 4.

/[NO]DEBUG[modifiers]

Enable you to selectively include and exclude debug information within the target program. OPTLINK lets you select debug information for the entire program, specific object modules (see also /DEBUGMODULES), specific object files, and specific library files (see also /DEBUGFILES). Additionally, you can selectively include or exclude the debug information itself (i. e. line numbers, local symbols, public symbols, and types). These switches can save recompiling to turn debugging information on and off in certain modules.

By default, when directed to output debug information, OPTLINK includes all debug information content. Use /CODEVIEW to inform OPTLINK of the desired debugger format.

If you supply no modifiers, the switch controls the inclusion of all debug information for any subsequently supplied files. You can also supply any of the following modifiers:

Supplying /NODEBUG turns off debug information generation. The switch must appear before selectively including debugging information for specific object files. For example:

LINK/CO:4/NODEBUG obj1/DEBUGLINES obj2/DEBUG obj3;
This forces OPTLINK to output full CodeView v4.x debugging information for file obj3 and only CodeView line number information for file obj2. It generates no debugging information for file obj1.
LINES
Controls the inclusion of line number information in debug and map output for any subsequently supplied files.
LOCALS
Controls the inclusion of local symbol information in debug output for any subsequently supplied files.
PUBLICS
Controls the inclusion of public symbol information in debug and map output for any subsequently supplied files.
TYPES
Controls the inclusion of type information in debug output for any subsequently supplied files.
Supplying /NODEBUG excludes debug information for specific object files. The switch must appear before selectively including debug information for specific files. For example:
LINK /CO:4/NODEBUG obj1/DEBUGLINES obj2/DEBUG obj3;
This example generates full CodeView 4.x debugging information for file obj3 and only CodeView line number information for obj2. No debugging information is generated for obj1.

/DEBUGFILES:filename[[:filename]...]

Causes OPTLINK to include all debugging information from the selected files. This saves recompiling to turn debugging information on and off in certain modules or when your debugger can't handle all modules at once. Use /CODEVIEW to inform OPTLINK of the desired debugger format.

filename File name to include debug information. OPTLINK includes debugging information in all object modules in the named object or library file. Any file name specified without an extension defaults to the extension .obj. You can enter multiple file names, but you must include complete paths and an additional blank before the colon, ":myfile".

/DEBUGMODULES:modname[[:modname]...]

Causes OPTLINK to include all debug information from the selected object modules. This saves recompiling to turn debugging information on and off in certain modules or when your debugger can't handle all modules at once. OPTLINK includes only the named object modules from the file. Use /CODEVIEW to inform OPTLINK of the desired debugger format.
modname    Object module name(s) to include debug information.

/[NO]DEFAULTLIBRARYSEARCH[:libname]

Default :       /DEFAULTLIBRARYSEARCH
Controls how OPTLINK handles comment records in .obj file requesting a library search. The default setting causes OPTLINK to search all requested libraries. Otherwise, OPTLINK does no searching.

libname Applicable only with /NODEFAULTLIBRARYSEARCH.
Specifies a library not to be searched. For example, "/NODEFAULTLIBRARYSEARCH:CLIBC" causes OPTLINK to ignore requests for CLIBC.LIB. You must provide a separate copy of the switch for each library name.

/[NO]DELEXECUTABLE

Default :       /NODELEXECUTABLE

Controls whether OPTLINK should delete the .exe or .dll output file upon encountering any link error.

/[NO]DETAILEDMAP

Default :       /NODETAILEDMAP
Controls the amount of detail provided in the segment list produced at the beginning of the .map file. /DETAILEDMAP provides much more detail about segment type, which modules added, how many bytes to the segment, and where each module begins.

/[NO]DOSSEG

Default :       /NODOSSEG
Controls .exe file segment sequence. When used, the segment sequence is: segments with a class name ending in CODE, then all segments not included in DGROUP, and, lastly, all segments of DGROUP (which will in turn be sequenced as BEGDATA, except BEGDATA, BSS and STACK, BSS, and finally STACK). Otherwise, segments appear in the sequence in which they are encountered while linking.

/[NO]ECHOINDIRECT

Default :       /NOECHOINDIRECT
Controls the echoing of indirect response file input lines to the console.

/EMSMAXSIZE:n

Default :       /EMSMAXSIZE:uses maximum available
For 16-bit real mode hosted versions only. Controls the maximum number of kilobytes of EMS that OPTLINK uses. n set to 0 forces no EMS use.

/[NO]EMSPAGEFRAMEIO

Default :       /EMSPAGEFRAMEIO
For 16-bit real mode hosted versions only. Most EMS memory systems are reliable when doing I/O to their page frame. Not quite so rare are disk cache programs that assume they are the only ones using the page frame and thus become confused when another program does. If you use one of these programs, supply /NOEMSPAGEFRAMEIO to stop the linker from doing I/O in the EMS page frame area. Normally, /EMSPAGEFRAMEIO is the fastest operation.

/[NO]EMSUSE40

Default :       /EMSUSE40
Controls whether OPTLINK adheres to LIM 3. 2. Some EMS memory managers claim to be LIM 4.0 compatible but are not. If you encounter problems using EMS memory, try forcing the linker to comply to LIM 3.2 by supplying /NOEMSUSE40. If the problems go away, report the problem to your EMS driver vendor. This option is normally /EMSUSE40 (LIM 4.0) for fastest operation.

/[NO]ERRORFLAG

Default :       /ERRORFLAG
Controls the setting of the error flag in a segmented-EXE or Win32 file header. When used, OPTLINK sets the flag when it encounters errors in the link process. Otherwise, OPTLINK does not set the flag even when it detects errors.

/[NO]EXEPACK[:n]

Default :       /NOEXEPACK

Causes OPTLINK to run-length encode the generated .exe output file to reduce its size. It also compresses relocation entries to produce much smaller .exe files, especially in medium and large memory models. The EXEPACK technique is fully compatible with the /RC option of OPTLINK. Microsoft's Resource Compiler is not compatible.

n is applicable only with /EXEPACK on DOS executables. It specifies how many bytes at the beginning of the memory image are not to be compressed. This permits easier maintenance of patch, configuration, serialization, and similar areas in the .exe file. The default value is 0.

/EXETYPE:[OS2|WINDOWS[n.nn]|DOS4|UNKNOWN|DOS|NT]

Specifies the operating system under which the current executable file is to run. This option works like the EXETYPE definition file directive; see its description in Definition File Directives for information.

/[NO]FARCALLTRANSLATION

Default :       /NOFARCALLTRANSLATION
Causes far calls to targets in the same segment to be converted to the equivalent combination of PUSH CS, NOP, and CALL NEAR. This can improve code performance and reduce .exe file size, since it eliminates the need for relocation entries. It also converts far jumps where possible. Supplying /FARCALLTRANSLATION forces /RELOCATIONCHECK.

/[NO]FIXDS

Default :       /NOFIXDS
This switch, applicable only to 16-bit Windows executables, does the same action as FIXDS directive in the .def file.

/FIXED

Causes the executable image to be fixed in place in memory.

/[NO]GROUPASSOCIATION

Default :       /GROUPASSOCIATION
Controls the use OPTLINK makes of GROUP information found in the .obj files. When used, OPTLINK uses all such information found in the files.

/[NO]GROUPSTACK

Default :       /NOGROUPSTACK
Controls stack definition in the standard DOS .exe file header. When used, OPTLINK writes values into the header in a group-based format that does not require your programs to modify the value of SS after loading. This action is not compatible with the output of most high-level languages; their startup code assumes that the stack is wrong, and adjusts it back into DGROUP. Thus, it is recommended to use this switch only with assembly language programs. Otherwise, OPTLINK writes these values in physical segment:offset form just as other linkers do, which effectively takes SS out of DGROUP.

/HEAP[:n

Sets the size of the executable file's local heap to n bytes. This option works like the HEAPSIZE definition file directive, except that the MAXVAL keyword is not supported. See the description of HEAPSIZE in Definition File Directives for information.

/HELP

Displays a list of available switches. In the list, those characters required to identify each switch appear in uppercase, while characters appearing in lowercase are optional and may be omitted.

/[NO]IGNORECASE

Default :       /IGNORECASE
Forces OPTLINK to preserve but ignore the cases of identifiers and symbols, including the optional symbol table that may be appended to the output file. Only one of /IGNORECASE, /NOIGNORECASE, /LOWERCASE, and /UPPERCASE can be in effect for any specific run of OPTLINK.

/IMPDEF[:dinname]

Causes OPTLINK to generate a .din file that combines information from the EXPORTS section of the .def file with __export directives, /BYORDINAL or /NONAMES switches. dinname is the .din file to be generated. Use /IMPDEF with /BYORDINAL, /IMPLIB, and /NONAMES to optimize the size and speed of your 16-bit code. See the description of /BYORDINAL for information.

/IMPLIB[:libname]

Builds an import library (.lib) file describing the exported symbols available to be imported from a dynamic link library (.dll), thus eliminating the need to run a separate utility to build the library. libname is the import library to build. Use /IMPLIB with /BYORDINAL, /IMPDEF, and /NONAMES to optimize the size and speed of your 16-bit code. See the description of /BYORDINAL for information.

/INFORMATION

Default :       /SILENT
This switch causes OPTLINK to display status information throughout the link process. It is the opposite of /SILENT.

/[NO]LINENUMBERS

Default :       /NOLINENUMBERS
Controls whether line-number information shall be contained within the .map file.

/LOWERCASE

Default :       /IGNORECASE
Forces OPTLINK to convert symbols to lowercase. Only one of /IGNORECASE, /NOIGNORECASE, /LOWERCASE, and /UPPERCASE can be in effect for any specific run of OPTLINK.

/MACHINE:type

Specifies the type of the target machine. type can be i386.

/[NO]MAP[:modifiers]

Default :       /NOMAP
Causes the addition of public symbols to the .map file. The /MAP option normally outputs the symbol twice:sorted alphabetically and by increasing addresses. It accepts any of the following modifiers: ADDRESS Outputs only the increasing address sort listing. FULL Produces detailed maps as does the /DETAILEDMAP switch. GROUP Displays the GROUP column on the report. NOGROUP Does not display the GROUP column. /MAP defaults to :NOGROUP.

/NOCVPACK

This switch suppresses automatic execution of the CVPACK step after a successful link for CodeView Version 4. This allows you to run Microsoft's CVPACK utility. By default, OPTLINK performs the CVPACK step when linking for CodeView 4.

/NOLOGO

This switch suppresses OPTLINK's normally displayed sign-on copyright message, unless errors are detected.

/NONAMES

Eliminates storage of name text for symbols exported by ordinal. This option can shrink .exe or .dll files by up to 64K bytes for 16-bit files. It also eliminates the 64K limit on exported names text for 16-bit files. Use /NONAMES with /BYORDINAL, /IMPLIB, and /IMPDEF to optimize the size and speed of your 16-bit code. See the description of /BYORDINAL for information.

/[NO]NULLDOSSEG

Default :       /NULLSDOSSEG
Controls the generation of 16 null bytes at the beginning of the _TEXT segment in DOSSEG mode. The Microsoft run-time usually requires this.

/ONERROR:NOEXE

Default :       /NODELEXECUTABLE
Causes OPTLINK to delete the .exe or .dll output file if any link error occurs. Normally the .exe file is not deleted upon an error.

/OPT

Uses OPTLINK syntax. Parsed and ignored.

/[NO]PACKCODE[:n]

Default :       /NOPACKCODE
Causes OPTLINK to combine any segments of class name ending in CODE, to a maximum size of n bytes. The main purposes of this are:
  1. To improve operation of the /FARCALLTRANSLATION option, since more targets will be in the same segments, and
  2. To reduce the segment count for segmented .exe files. Some debuggers also function better when the segment count is kept low. /PACKCODE causes segments to be logically combined (packed) into larger physical segments.
Note Applicable only with /PACKCODE is n: the maximum segment size of groups. /PACKSIZE controls the default value. Values of 8192 or 16384 may provide better performance for large applications because the segments being swapped, discarded, and reloaded are smaller.

/[NO]PACKDATA[:n]

Default :       /NOPACKDATA
Causes OPTLINK to combine data segments if possible, to produce larger, but fewer, data segments. /PACKDATA causes segments to be combined (packed) into larger physical segments. Note Applicable only with /PACKDATA is n: the maximum segment size of groups. /PACKSIZE controls the default value. Values of 8192 or 16384 may provide better performance for large applications because the segments being swapped, discarded, and reloaded are smaller.

/[NO]PACKFUNCTIONS

Default :       /PACKFUNCTIONS
Enables true smart linking of object files containing COMDAT records. OPTLINK retains only referenced COMDAT records. OPTLINK is fully recursive in this support; it removes unnecessary COMDATs and library modules from the executable.

/[NO]PACKIFNOSEGMENTS

Default :       /PACKIFNOSEGMENTS
Forces /PACKCODE on Windows output if the .def file does not use a SEGMENTS directive. MS-LINK has an undocumented feature/bug in which /PACKCODE:65500 is enabled for Windows .exe/. dlls if the .def file does not use a SEGMENTS directive. This option is enabled by default for compatibility. You may want to disable it.

/PACKSIZE:n

Default :       /PACKSIZE:65500
Sets the default size (in bytes) for the /PACKDATA and /PACKCODE switches.

/PAGESIZE:n

Default :       /PACKSIZE:16
Sets the page size for the /IMPLIB link option. The default value is 16, which allows a .lib file of up to 1Mb in size. n must be a power of 2 greater than or equal to 16.

/[NO]PAUSE

Default :       /NOPAUSE
Allows swapping of diskettes just before OPTLINK writes binary output data.

/PMTYPE:type

Default :       /PMTYPE:PM
This switch, used only when producing segmented executable or .dll output, requires one of three type specifiers. PM The application is Windows or PM and can execute only in the Windows or PM environment. For Windows, this eliminates the need to use RC if there are no resources. This format is the default output from OPTLINK.

/[NO]PROMPT

Default :       /PROMPT
Determines whether OPTLINK prompts for input if additional link switches were expected (that is, if no semicolon (;) appeared at the end of the list of switches).

/RC[options][:filename]

Provides an alternative to the RC statement in the .def files. The .res file is assumed to be the same primary name as the .exe or .dll. Effective only when the switch is supplied. There can be multiple instances of /RC.

This switch accepts the same eight options (each preceded by "-", a hyphen) accepted by the RC directive in the .def file. They are:

option meaning
-e Creates a driver that uses EMS memory
-k Keep segments in .def file order; does not sort or create a fast-load section
-l Creates an LIM 3.2 EMS application
-m Sets multiple instance flag
-p Create a private library (PRIVATELIB).
-t Creates a protected-mode-only application (PROTMODE).
-30 Tags the executable as requiring Windows 3.0 or later to run
-31 Tags the executable as requiring Windows 3.1 or later to run

filename is the optional file name. You can use /RC without a filename to mark .exe or .dll files as valid Windows files (ignore the file-not-found warning that results). It also causes preload segment reordering to occur.

/[NO]RELOCATIONCHECK

Default :       /RELOCATIONCHECK
This switch causes OPTLINK to do extra processing to ensure that no relocation overlaps occur. Although rare, such overlaps can occur under the following circumstances: when initializing common blocks in more than one module or ORGing back over a relocation item in assembly language or when a translator error occurs.

/[NO]REORDERSEGMENTS

Default :       /NOREORDERSEGMENTS
Allows OPTLINK to perform segment reordering. First, it orders all grouped segments so that segments belonging to a particular group are contiguous. It then orders all non-grouped segments so that code segments (classes ending in CODE) are together, and, therefore, all data segments are together. This allows the maximum benefit from /PACKCODE and /PACKDATA.

/[NO]SCANLIB

Default :       /SCANLIB
Forces OPTLINK to scan the LIB environment variable for additional library paths. You can use the LIB environment variable to aid in the drop-in-replacement use of OPTLINK. This option works only in the optlinks. cfg file, since OPTLINK scans environment variables before scanning the command line.

/[NO]SCANLINK

Default :       /SCANLINK
Forces OPTLINK to scan the LINK environment variable for additional option switches. You can use the LINK environment variable to aid in the drop-in-replacement use of OPTLINK. When supplied, OPTLINK scans LINK before scanning the OPTLINK environment variable. This option works only in the optlinks. cfg file, since OPTLINK scans environment variables before scanning the command line.

/SILENT

Default :       /SILENT
This switch causes OPTLINK to suppress status information throughout the link process. It is the opposite of /INFORMATION.

/STACK[:n

Controls the stack size. If supplied, it also defines a stack segment (in DGROUP if you use /DOSSEG) if one isn't specified in the .obj file. n specifies the size of the stack in bytes. You must specify this number; in 16-bit code it must not exceed decimal 65535.

/STUB:filename or STUB:NONE

Specifies a "stub" routine to be added to the output executable file to terminate its operation with a warning message. This option works like the STUB Module Definition File directive.

/SUBSYSTEM [ NATIVE | WINDOWS [:n.nn] | CONSOLE | POSIX ]

Default :       /SUBSYSTEM:CONSOLE
This option works like the SUBSYSTEM Module Definition File directive.

/TINY

This switch causes OPTLINK to generate a .com file instead of an .exe file. The .com file automatically starts at offset 0100h in the code segment. To generate memory image files that start at other locations, use the /BINARY option switch.

/UPPERCASE

Default :       /IGNORECASE

Forces OPTLINK to convert symbols to upper case. Only one of /IGNORECASE, /NOIGNORECASE, /LOWERCASE, and /UPPERCASE can be in effect for any specific run of OPTLINK.

/VERSION:nn[.mm]

Puts the specified version number in the executable file. nn is the major version number; mm is the minor version number.

/[NO]WARNDUPS

Default :       /NOWARNDUPS

Forces OPTLINK to output warning messages upon encountering duplicate library symbols. Very useful in debugging complex applications.

/[NO]WINPACK

Default :       /NOWINPACK

Compresses 16-bit Windows .exe or .dll output files and adds a decompressing loader to the file. /WINPACK typically decreases the size of .exe and .dll output files by 50%. This option requires the use of OPTLINK's /RC link option (rather than using other resource binders).

To obtain maximum compression:

If your application contains .res files, you must use OPTLINK to bind them to the packed executable. /WINPACK's decompressing loader must be segment number 1 in an .exe or .dll file, leaving 253 segments available for the application (one less than without /WINPACK). All segments are compressed, so if some value or string is modified after linking (for example, a product serial number), it will have to be located somewhere other than a code or data segment, perhaps in a resource.

For DLLs that cross-reference one another (for example, A. DLL references items in B. DLL, and B. DLL references items in A. DLL), neither DGROUP nor the code segment containing the start address can contain references to a DLL it cross-references. Since /WINPACK compresses segments and relocations but not resources, the output file may be made even smaller by running it through another compression program after linking.

/XMSMAXSIZE:n

Default :       /XMSMAXSIZE uses maximum available

Controls the maximum number of kilobytes of XMS memory that OPTLINK uses. n set to 0 forces no XMS use.

/XNOIGNORECASE

Default :       /XNOIGNORECASE

Forces OPTLINK to treat EXPORT and IMPORT symbols as case significant. Only one of /XNOIGNORECASE and /XUPPERCASE can be in effect for any specific run of OPTLINK.

Note: By default, the case of IMPORT and EXPORT symbols is significant. (In previous versions of Digital Mars C++, the default was /XUPPERCASE.) If a working application now generates run-time errors pertaining to undefined symbols, the case of symbols in some modules or libraries might be mismatched. Try rebuilding the application using the /UPPERCASE option, or declare the EXPORT and IMPORT symbols in definition files the same way they appear in object files.

/[NO]XREF

Default :       /NOXREF

Controls whether OPTLINK adds cross reference information to the .map file. That is, for every global symbol, OPTLINK lists the module name where defined, followed by every other module name that referenced it.

/XUPPERCASE

Default :       /XUPPERCASE

Forces OPTLINK to convert EXPORT and IMPORT symbols to upper case. Only one of /XNOIGNORECASE and /XUPPERCASE can be in effect for any specific run of OPTLINK.

/?

Identical to /HELP. Displays a list of available switches. In the list, those characters required to identify each switch appear in uppercase, while characters appearing in lowercase are optional and may be omitted.

Home | Runtime Library | IDDE Reference | STL | Search | Download | Forums