Create Link Overlays Using Parentheses or a .DEF File

ID: Q95181


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0


SUMMARY

You need Link overlays to create programs that are larger than available conventional memory. To create Link overlays, the linker adds code into your executable (.EXE) file to manage overlays and swap portions of your code from expanded memory, extended memory, or disk to conventional memory.

There are two methods for creating overlays in Visual Basic for MS-DOS. The first method is to place parentheses around the .OBJ module names you want to overlay. You can do this either on the Link command line or in a response file. The second, and newer, method involves creating a module definition file (.DEF) in which you specify the overlays by module name. Both of these methods, however, require that you link your program from the MS-DOS command line and not from the interpreter environment.


MORE INFORMATION

For more information on Link overlays, query on the following words in this Knowledge Base:

link and overlay and code and segment
Using parentheses to create overlays is the simplest method but is not quite as versatile as using a .DEF file. To specify which modules you want to be overlaid, place parentheses around the modules on the Link command line. However, you must not overlay the main module, the one that occurs first on the Link command line. Here is an example showing how to use the parentheses method:

   LINK MAIN.OBJ (MOD1.OBJ) (MOD2.OBJ) (MOD3.OBJ MOD4.OBJ); 
In this example, three overlays are created, the last of which contains two separate modules. When you run this program, calls to a Sub procedure that resides in one of the modules will cause that module to be copied into conventional memory from expanded memory, extended memory, or from disk.

There are advantages in using a .DEF file. You can specify individual modules out of a library of routines without having to include them all in the overlay. Specify the .DEF file as the last parameter on the Link command line.

You can create a .DEF file in the VBDOS.EXE interpreter environment or in any other text editor. A .DEF file contains the name of the source file, the class name of the code segment, and the number of the overlay. The following is a .DEF file that does the same thing as the previous Link statement shown above:

   SEGMENTS
 
      'MOD1_CODE' CLASS 'BC_CODE' OVL:1
      'MOD2_CODE' CLASS 'BC_CODE' OVL:2
      'MOD3_CODE' CLASS 'BC_CODE' OVL:3
      'MOD4_CODE' CLASS 'BC_CODE' OVL:3 
Link the program in the following manner assuming the name of the .DEF file is MAIN.DEF:

   LINK MAIN.OBJ MOD1.OBJ MOD2.OBJ MOD3.OBJ MOD4.OBJ,,,,MAIN.DEF; 
In the .DEF file, Basic module file names are always followed by _CODE and the class name of the code segment is always BC_CODE.

Note that there is a documentation error on Page 31 of the Professional Edition of the "Microsoft Visual Basic for MS-DOS Professional Features" manual. It states you only need the module name but omits the fact that you need to add _CODE to the end of each Basic module name.

When you create overlays that use non-Basic modules, the Module name and class name can be found by viewing the .MAP file that contains the names of those routines. The following is a sample entry in a .DEF file for a non-Basic routine:

      'MOD1_TEXT' CLASS 'CODE' OVL:1 
This information is documented in Chapter 2 of the Professional Edition of the "Microsoft Visual Basic for MS-DOS Professional Features" manual.

Additional query words: VBmsdos 1.00 docerr

Keywords :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.