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, the linker makes decisions to resolve any conflicts and assumes a set of attributes.
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.
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.
load
{PRELOAD | LOADONCALL}
Determines when a segment is loaded.
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. 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 writable.
shared
{SHARED | NONSHARED}
For real-mode Windows only. Determines whether all instances of the program can share EXECUTEREAD and READWRITE segments.
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, the linker assumes SHARED; if DATA MULTIPLE is specified, the linker assumes NONSHARED. Similarly, DATA SHARED forces SINGLE, and DATA NONSHARED forces MULTIPLE.