LINK Help (linker.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SEGMENTS Statement
                                             Up Contents Index Back
─────LINK───────────────────────────────────────────────────────────────────
 
     Syntax:  SEGMENTS
                segmentdefinitions
 
     This statement defines the attributes of one or more individual
     segments. The attributes specified for a specific segment override
     defaults set in CODE and DATA statements (except as noted). The
     total number of segment definitions cannot exceed the number set
     using LINK's /SEG option. (The default without /SEG is 128.)
     See: CODE Statement
          DATA Statement
          /SEG Option
 
     The SEGMENTS keyword marks the beginning of a section of segment
     definitions. Multiple definitions must be separated by one or more
     spaces, tabs, or newline characters. SEGMENTS must appear once
     before the first definition (on the same or preceding line) and
     can be repeated before each additional specification. SEGMENTS
     statements can appear more than once in the .DEF file.
 
     Segment-Definition Syntax
 
          [']segmentname['] [CLASS 'classname'] [attribute...]
 
     or
 
          [']segmentname['] [CLASS 'classname'] [OVL:overlaynumber]
 
     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.
     See: Reserved Words
 
     CLASS <classname> optionally specifies the class of the segment
     and must be enclosed in single or double quotation marks. The
     default class is CODE.
 
     One or more attributes can be specified for a segmented executable
     file. Each can appear once, in any order. LINK ignores attributes
     if OVL is specified.
 
     Attribute           Purpose
 
     <discard>         Sets whether segment is discardable
     <executeonly>     Sets execute status
     <load>            Sets when segment is loaded
     <movable>         Sets whether segment is movable
     <readonly>        Sets read status
     <shared>          Sets whether segment is shareable
 
     The OVL keyword tells LINK to create a DOS program that contains
     overlays. If OVL is used, LINK assumes EXETYPE DOS. An alternate
     keyword is OVERLAY. The <overlaynumber> specifies the overlay in
     which the segment is to be placed. The value 0 represents the
     root, and positive decimal numbers through 65,535 represent
     overlays. By default, a segment is assigned to the root.
     See: Creating Overlaid DOS Programs
          EXETYPE Statement
 
     Examples
 
          SEGMENTS
            cseg1 CLASS 'mycode'
            cseg2                EXECUTEONLY PRELOAD
            dseg  CLASS 'data'   LOADONCALL READONLY
 
     This example specifies segments named cseg1, cseg2, and dseg.
 
          SEGMENTS myseg OVL:2
 
     This statement places the myseg segment into the second overlay.
                                    -♦-