12.7.3 How Overlays Work

Programs that use overlays require the overlay-manager code to handle module swapping. This code is included as part of the standard libraries for Microsoft high-level languages. If you specify overlays during linking, the code for the overlay manager is automatically linked with the rest of your program.

LINK produces only one .EXE file. The overlay manager searches for this file whenever another overlay needs to be loaded. It first searches in the current directory. If the file is not there, the manager then searches the directories in the PATH environment variable. If the overlay manager still cannot find the file, it prompts for the pathname.

Example

Assume that an executable program called PAYROLL.EXE uses overlays and does not exist in either the current directory or the directories specified by PATH. If you run PAYROLL.EXE by entering a complete path specification, the overlay manager displays the following message when it attempts to load an overlay file:

Cannot find PAYROLL.EXE

Please enter new program spec:

You can then enter the drive or directory, or both, where PAYROLL.EXE is located. For example, if the file is located in directory \EMPLOYEE\DATA\ on drive B, enter B:\EMPLOYEE\DATA\; if the current drive is B, you can enter just \EMPLOYEE\DATA\.

If you later remove the disk in drive B and the overlay manager needs the overlay again, it does not find PAYROLL.EXE and displays the following message:

Please insert diskette containing B:\EMPLOYEE\DATA\PAYROLL.EXE

in drive B: and strike any key when ready.

After the overlay file has been read from the disk, the overlay manager displays the following message:

Please restore the original diskette.

Strike any key when ready.