1.From the Options menu, choose Project.
2.From the Customize Build Flags box, choose the Linker button. The Customize Linker Options dialog box appears (see Figure 9.6).
Some options are specified using dialog box selections; others in the Customize Options text boxes. Some options can be specified either way. The following two sections describe the options available as choices in this dialog box; the last section lists all custom options and details about each option.
The choices in the Global Options box affect all builds of your program, whether debug or release.
Ignore Case
Causes the linker to treat uppercase and lowercase letters in identifiers as equivalent. When this check box is turned off, two identifiers that are the same except for case are considered to be different identifiers. Turning off this check box is equivalent to typing /NOI in Custom Options. This check box is turned on by default for Windows programs and turned off for DOS programs.
Extended Dictionary
Causes the linker to search extended dictionaries in libraries when resolving references. Extended dictionaries speed up the linking process; however, a linking error might occur if duplicate definitions exist. For details about extended dictionaries, see “How the Linker Resolves References” on page 209. Turning off this check box is equivalent to typing /NOE in Custom Options. This check box is turned on by default.
Ignore Default Libraries
Prevents the linker from using the default libraries named in object files when resolving references. If you turn on this check box and your program uses C run-time references, your Project list must contain an alternative library to resolve these references. This option is equivalent to the /NOD option. If you want the linker to ignore a specific default library, type /NOD:libraryname in Custom Options. (See the description of /NOD on page 219.) This check box is turned off by default.
Stack Size
Sets the stack size in bytes. The size can be any even value up to 64K, specified in decimal or C-language notation. This option is equivalent to the /STACK option. A stack size set in this dialog box overrides a STACK statement in a module-definition file. By default, this text box is set to 5,120 for Windows programs and 2,048 for DOS programs. (This option is unavailable for Windows DLLs.)
Alignment
Aligns segments in a Windows file on disk. The boundary size is in bytes and must be an integer power of 2, specified in decimal or C-language notation; the default value is 16. Alignment does not affect the size of a file when it is loaded in memory. This option is equivalent to the /ALIGN option. (This option is unavailable if the program type is DOS EXE.)
The options in the Debug Options box apply only to a debug build of your program.
CodeView Info
Adds symbolic information to the program in preparation for debugging by either the Graphical Development Environment debugger or the CodeView debugger. To use this option, you must also turn on the CodeView Info check box in the Customize C Compiler Options dialog box. This option is equivalent to the /CO option. This check box is turned on by default.
CV 3.0 Format
Adds the CodeView symbolic information in the format required by CodeView versions 3.x, including CVW 3.0. This check box is turned off by default for Windows programs; it is on by default for DOS programs because you must debug them outside of the Development Environment. Do not turn on this check box for Windows programs you intend to debug using the Development Environment debugger. When this check box is turned off, the linker calls CVPACKW.EXE; this file must be in the current directory or in a directory specified in the PATH environment variable. This option is unavailable if the CodeView check box described above is not turned on.
Map File
Creates a listing of segments in your program during a debug build. The file is created in the current directory with the name of the project and the extension .MAP. This check box is turned on by default.
You can add information to this listing by specifying the /MAP and /LINK options in the Custom Options box. The /MAP option adds public symbols to the map file. The /LINE option adds line number information if the CodeView Info check box in the Customize C Compiler Options dialog box has been turned on. Either /MAP or /LINK (or both) forces the creation of a map file even if the Map File check box is turned off; if these options are specified in the Global or Release text box, they force a map file to be created during a release build.
You can specify any valid linker option in the text boxes of the Custom Options group. Use the Global text box to set options for all build versions, and use the Debug and Release text boxes to set options for those versions of your program.
Options specified in Custom Options override any conflicting options that are set in other boxes. If you specify a custom option that is also available as a choice elsewhere in this dialog box, the Graphical Development Environment applies the option you've specified to the current settings in the dialog box.
To specify a custom option, type the option specifier (/) followed by the option name and any arguments needed. Separate multiple options with one or more spaces or tabs. Numeric arguments can be in decimal or C-language notation. Options are not case sensitive and can be abbreviated to the shortest unique form; the description for each option shows the minimum legal abbreviation with the optional part enclosed in double brackets. No gaps or transpositions of the letters are allowed. This chapter uses meaningful yet legal forms of the option names.
Custom Options for All Programs
The following options are available only as custom options and apply to all program types:
/F[[ARCALLTRANSLATION]]
Directs LINK to optimize far calls to procedures that lie in the same segment as the caller. Far-call translation is turned on by default for DOS .EXE files and off by default for Windows programs. Use the /NOFARCALL option to override /FARCALL.
/LI[[NENUMBERS]]
Adds source-file line numbers and associated addresses to the map file. The object file must be created with line numbers (by turning on the CodeView Info check box in the Customize C Compiler Options dialog box); /LINE is ignored if line-number information is missing. This option creates a map file even if the Map File check box is not turned on or Release is selected.
/M[[AP]]
Adds public symbols to the map file. By default, the map file contains only a list of segments. This option creates a map file even if the Map File check box is not turned on or Release is selected.
/NOF[[ARCALLTRANSLATION]]
Turns off far-call translation (optimization of far calls to near calls where possible). Far-call translation is turned on by default for DOS .EXE files and off by default for Windows programs; use /NOFARCALL to override far-call translation.
/PACKD[[ATA]][[:number]]
Packs neighboring data segments together for memory models with multiple data segments. Specify number bytes to set the maximum size for physical segments formed. The default without number or without /PACKD is 64K. This option is for Windows programs only.
/SE[[GMENTS]][[:number]]
Sets the maximum number of segments from 1 to 16,384. The default is 128. Lower limits allow faster linking; higher limits allocate space for more segments.
Custom Options for DOS Applications
The following options, available only as custom options, apply to DOS applications alone:
/CP[[ARMAXALLOC]]:number
Sets the program's maximum memory allocation to the specified number of 16-byte paragraphs, where number is from 1 to 65,535.
/DO[[SSEG]]
Forces segments to be ordered as follows:
1.Segments with class name ending in CODE
2.All other segments outside DGROUP
3.DGROUP segments, in the following order:
A. Segments of class BEGDATA
B. Segments not of class BEGDATA, BSS, or STACK
C. Segments of class BSS
D. Segments of class STACK
The /DOSSEG option initializes variables _edata and _end, and inserts 16 null bytes at the beginning of the _TEXT segment (if this segment is defined). Insertion of nulls is overridden by the /NONULLS option when both are used; use /NONULLS to override the DOSSEG comment record commonly found in standard Microsoft libraries. This option is for assembly-language programs only.
/DS[[ALLOCATE]]
Directs LINK to load all data starting at the high end of the data segment instead of the low end. For maximum advantage, use the /HIGH option with /DSALLOC. The /DSALLOC option is for assembly-language programs that create DOS .EXE files.
/E[[XEPACK]]
Packs the executable file during linking by removing series of repeated bytes and optimizing the relocation table. This may reduce file size but will increase program load time. The /EXEPACK option is incompatible with CodeView.
/HI[[GH]]
Places the executable file as high in memory as possible. Use /HIGH with the /DSALLOC option. This option is for assembly-language programs that create DOS .EXE files.
/NON[[ULLSDOSSEG]]
Directs LINK to arrange segments in the executable file in the same order as they are arranged by the /DOSSEG option, but with no additional bytes at the beginning of the _TEXT segment (if it is defined). This option overrides /DOSSEG when both are used.
/NOP[[ACKCODE]]
Turns off code-segment packing. This option overrides /PACKC if it is specified later than /PACKC. Code-segment packing is off by default.
/PACKC[[ODE]][[:number]]
Packs neighboring code segments together in memory models with multiple code segments. Specify number bytes to set the maximum size for physical segments formed by /PACKC. The default without number or without /PACKC is 64K minus 36 bytes. When used with /FARCALL, /PACKC produces faster code. This option overrides /NOPACKC if it is specified later than /NOPACKC.
Custom Options Also Available as Dialog Choices
All of the following options, except /PM, can be specified as custom options but are also represented as choices in this dialog box. The Graphical Development Environment will modify the current settings in this dialog box if you specify one of these options. The /PM option is represented in the .DEF file required by your choice of Program Type.
/A[[LIGNMENT]]:size
Directs LINK to align segment data in a segmented executable file along the boundaries specified by size bytes, where size must be a power of two. Equivalent to entering a value in the Alignment text box under Global Options. This option is ignored for DOS programs.
/CO[[DEVIEW]]
Adds symbolic data and line numbers for use by the CodeView debugger. Equivalent to turning on the CodeView Info check box under Debug Options. This option is incompatible with the /EXEPACK option.
/NOD[[EFAULTLIBRARYSEARCH]][[:libraryname]]
Tells LINK to ignore default libraries named in .OBJ files when LINK searches libraries to resolve references. Equivalent to turning on the Ignore Default Libraries check box under Global Options. Specify with-out libraryname to cause all default libraries to be ignored. Specify libraryname to tell LINK to ignore a single library. To ignore more than one specific library, use separate specifications of /NOD:libraryname.
/NOE[[XTDICTIONARY]]
Prevents LINK from searching extended dictionaries in libraries. Suppress this search when you are redefining a symbol or function defined in a library and you receive error L2044. Equivalent to turning off the Extended Dictionary check box under Global Options. This option will cause slower linking.
/NOI[[GNORECASE]]
Preserves case in identifiers. Equivalent to turning off the Ignore Case check box under Global Options. By default, case sensitivity is not in effect for Windows programs and is preserved for DOS programs.
/PM[[TYPE]]:type
Specifies the type of a Windows application. The /PM option is equivalent to a type specification in a NAME statement in a module-definition file, as shown in the following list. For more information, see the NAME statement in Appendix A, “Module-Definition Files.”
Type | NAME Statement Equivalent |
PM | WINDOWAPI |
VIO | WINDOWCOMPAT |
NOVIO | NOTWINDOWCOMPAT |
/ST[[ACK]]:number
Sets the stack size to number bytes, from 2 bytes to 64K. Equivalent to entering a value in the Stack Size text box under Global Options. Do not specify /STACK for a DLL.
Options for Other Linkers
The following options for other linkers are not available or are not used with the linker in the Graphical Development Environment:
/B[[ATCH]]/HE[[LP]]/INC[[REMENTAL]]/INF[[ORMATION]]/NOG[[ROUPASSOCIATION]]/NOL[[OGO]]/O[[VERLAYINTERRUPT]]/PADC[[ODE]]/PADD[[ATA]]/PAU[[SE]]/Q[[UICKLIB]]/T[[INY]]/W[[ARNFIXUP]]/?