The SEGMENTS statement defines the attributes of one or more individual segments in the application or DLL. The attributes specified for a specific segment override the defaults set in the CODE and DATA statements (except as noted below). The total number of segment definitions cannot exceed 128 (or the number set using the linker's /SEG option).
The SEGMENTS keyword marks the beginning of the segment definitions, where each definition is on its own line. The SEGMENTS statement must appear once before the first specification (on the same or preceding line) and can be repeated before each additional specification. SEGMENTS statements can appear more than once in the file.
Summary: Syntax
SEGMENTS
[[']]segmentname[[']] [[CLASS 'classname']] [[attribute...]]
Summary: Remarks
Each segment definition begins with segmentname, optionally enclosed in single or double quotation marks (' or "). The quotation marks are required if segmentname is a reserved word.
The CLASS keyword optionally specifies the class of the segment. Single or double quotation marks (' or ") are required around classname. If you do not use the CLASS argument, the linker assumes that the class is CODE.
This statement accepts several optional attribute fields: discard, executeonly, load, movable, readonly, and shared. Each can appear once, in any order. These fields are described in the next section, “CODE, DATA, and SEGMENTS Attributes.”
Summary: Example
The following example specifies segments named cseg1, cseg2, and dseg. The first segment is assigned the class mycode and the second is assigned CODE by default. Each segment is given different attributes.
SEGMENTS
cseg1 CLASS 'mycode' MOVABLE
cseg2 EXECUTEONLY PRELOAD
dseg CLASS 'data' NONSHARED READONLY