The following attribute fields apply to the CODE, DATA, and SEGMENTS statements described previously. Refer to “Remarks” in each of the previous sections for the attribute fields 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 are keywords that are legal values for the field. The fields and keywords are described, and 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.
discard
{DISCARDABLE | NONDISCARDABLE}
Used 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. The default is NONDISCARDABLE.
executeonly
{EXECUTEONLY | EXECUTEREAD}
Used 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}
Used 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}
Used for CODE, DATA, and SEGMENTS statements. 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}
Used for CODE, DATA, and SEGMENTS statements. Determines whether a segment can be moved in memory. This attribute is valid only for a Windows DLL or a real-mode Windows application. FIXED is the default. An alternative spelling for MOVABLE is MOVEABLE.
readonly
{READONLY | READWRITE}
Used 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}
Used 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 that access 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.