Creating the Module-Definition File

To specify the organization of your overlaid program, write a “module-definition file.” A module-definition (.DEF) file is a text file that describes a program's characteristics. This information is used by LINK. Valid statements in a .DEF file for an overlaid program are SEGMENTS, FUNCTIONS, and INCLUDE. LINK ignores other module-definition statements when linking an overlaid DOS program. Chapter 16 describes all the features of .DEF files.

Note:

The predecessor to MOVE, the Microsoft Static Overlay Manager, uses parentheses in the command-line syntax to place entire object files into overlays. This method of specifying overlays is still supported; however, conflicts may arise if you also use a module-definition file. A .DEF file is the preferred method and gives more control in assigning code to overlays.

The FUNCTIONS and SEGMENTS Statements

The FUNCTIONS and SEGMENTS statements place code in overlays. Use the FUNCTIONS statement to assign an individual function to either an overlay or to a segment. Use the SEGMENTS statement to assign a segment an overlay. The SEGMENTS statement is described on topic ; the FUNCTIONS statement is described on topic .

Valid overlay numbers are from 1 through 65,535; to place code in the root, specify 0. The space allocated for overlay information is determined by the highest overlay number, whether or not every intermediate number is actually used. For the most efficient use of space, it is recommended that you use a continuous sequence of numbers beginning with 1.

You can use the FUNCTIONS and SEGMENTS statements to organize overlays in the following ways:

To place an entire segment into an overlay, use the SEGMENTS statement specified with an overlay number. For example, the following statement places the segment called myseg into the second overlay:

SEGMENTS myseg OVL:2

To place individual functions into an overlay, use the FUNCTIONS statement specified with an overlay number. The functions must be compiled as packaged functions (see “Compiling for Overlays”). The following statement places three functions into the second overlay:

FUNCTIONS:2 myfunc1 myfunc2 myfunc3

If the function is explicitly allocated, it cannot be assigned to a different overlay from the segment that contains the function. Explicit allocation is described in “Compiling for Overlays”.

To place individual functions into a segment and then place the segment into an overlay, use the FUNCTIONS statement specified with a segment name and the SEGMENTS statement specified with the segment name and an overlay number. The functions must be compiled as packaged functions. An explicitly allocated function cannot be assigned to a segment different from the one to which it was allocated. The following statements assign myseg to the second overlay and place three functions into myseg:

SEGMENTS myseg OVL:2

FUNCTIONS:myseg myfunc1 myfunc2 myfunc3

To assign an explicitly allocated function to an overlay, use the FUNCTIONS statement specified with an overlay number, and do not assign its segment or any other functions in that segment to an overlay. The FUNCTIONS statement, in this case, implicitly assigns the entire segment to the overlay. For example, if myfunc is explicitly allocated to the segment myseg, and myseg and its other functions are not assigned to an overlay, the following statement implicitly places all code in myseg into the second overlay:

FUNCTIONS:2 myfunc

The INCLUDE Statement

The INCLUDE statement inserts a specified text file at the place where it is specified in a .DEF file. The INCLUDE statement behaves the same way in .DEF files for all program types. This statement is described on page XXX. For example, the following statement tells LINK to read SEGMENTS.TXT before it processes the rest of the .DEF file:

INCLUDE segments.txt