13.15 CODE, DATA, and SEGMENTS Attributes

The following attribute fields apply to the CODE, DATA, and SEGMENTS statements previously described. Refer to “Remarks” in each of the previous sections for the attribute fields that are used by each statement. Most fields are used by all three statements; others are used as noted. Each field can appear once, in any order.

Listed with each attribute field below are keywords that are legal values for the field, along with descriptions of the field and values. The defaults are noted. If two segments with different attributes are combined into the same group, LINK makes decisions to resolve any conflicts and assumes a set of attributes.

Attribute Description

conforming {CONFORMING | NONCONFORMING}
  For CODE and SEGMENTS statements only. Determines whether a code segment is an 80286 “conforming” segment for device drivers and system-level code. The conforming attribute is for OS/2 only.
  CONFORMING specifies that the segment executes at the caller's privilege level. When IOPL=YES is specified in CONFIG.SYS, no call gates are generated for calls or jumps.
  NONCONFORMING (the default) specifies that the segment can be accessed from Ring 2. When IOPL=YES is specified in CONFIG.SYS, call gates are generated.
  For more information, refer to Intel documentation for the 80286 processor and later.
discard {DISCARDABLE | NONDISCARDABLE}
  For CODE and SEGMENTS statements only. Determines whether a code segment can be discarded from memory to fill a different memory request. If the discarded segment is accessed later, it is reloaded from disk. NONDISCARDABLE is the default. The discard attribute is for Windows only.
executeonly {EXECUTEONLY | EXECUTEREAD}
  For CODE and SEGMENTS statements only. Determines whether a code segment can be read as well as executed.
  EXECUTEONLY specifies that the segment can only be executed. The keyword EXECUTE-ONLY is an alternate spelling.
  EXECUTEREAD (the default) specifies that the segment is both executable and readable. This attribute is necessary for a program to run under the Microsoft CodeView debugger.
instance {NONE | SINGLE | MULTIPLE}
  For the DATA statement only. Affects the sharing attributes of the default data segment (DGROUP). This attribute interacts with the shared attribute.
  NONE tells the loader not to allocate DGROUP. Use NONE when a DLL has no data and uses an application's DGROUP.
  SINGLE (the default for DLLs) specifies that one DGROUP is shared by all instances of the DLL or application.
  MULTIPLE (the default for applications) specifies that DGROUP is copied for each instance of the DLL or application.
iopl {IOPL | NOIOPL}
  Determines whether a segment has I/O privilege. OS/2 only.
  IOPL specifies that a code segment has I/O privilege and that a data segment can be accessed only from an IOPL code segment.
  NOIOPL (the default) specifies that there is no I/O privilege for code and no protection for data.
load {PRELOAD | LOADONCALL}
  Determines when a segment is loaded.
(load, continued) PRELOAD specifies that the segment is loaded when the program starts.
  LOADONCALL (the default) specifies that the segment is not loaded until accessed and only if not already loaded.
movable {MOVABLE | FIXED}
  Determines whether a segment can be moved in memory. Windows only. FIXED is the default. An alternative spelling for MOVABLE is MOVEABLE.
readonly {READONLY | READWRITE}
  For DATA and SEGMENTS statements only. Determines access rights to a data segment.
  READONLY specifies that the segment can only be read.
  READWRITE (the default) specifies that the segment is both readable and writeable.
shared {SHARED | NONSHARED}
  For real-mode Windows and for READWRITE data segments under OS/2 only. Determines whether all instances of the program can share EXECUTEREAD and READWRITE segments. (Under OS/2, all code segments and READONLY data segments are shared.)
  SHARED (the default for DLLs) specifies that one copy of the segment is loaded and shared among all processes accessing the application or DLL. This attribute saves memory and can be used for code that is not self-modifying. An alternate keyword is PURE.
  NONSHARED (the default for applications) specifies that the segment must be loaded separately for each process. An alternate keyword is IMPURE.
  This attribute and the instance attribute interact for data segments. The instance attribute has the keywords NONE, SINGLE, and MULTIPLE. If DATA SINGLE is specified, LINK assumes SHARED; if DATA MULTIPLE is specified, LINK assumes NONSHARED. Similarly, DATA SHARED forces SINGLE, and DATA NONSHARED forces MULTIPLE.