MORE INFORMATION
A dual-mode application is not the same as a bound application under
OS/2. A dual-mode application is actually two programs, one MS-DOS and
one OS/2, that are "glued" together to form one executable file.
Every OS/2 program, when linked, has the option to link-in a "stub"
MS-DOS program. Originally, the stub MS-DOS program was meant to print an
appropriate message when you attempt to run an OS/2 program under MS-DOS.
Usually the message is "This program cannot be run in MS-DOS mode," or a
similar message. You include this stub MS-DOS program by putting the
following line in the linker .DEF file when you link the OS/2 program
(where DOSPROG.EXE is the name of your own MS-DOS program):
Originally, the only purpose of this stub file was to print this
user-friendly message, and then exit back to MS-DOS. Eventually,
programmers began to let this "stub" program get larger and larger
until it became a full-blown application that ran under MS-DOS when you
attempted to run the OS/2 program in MS-DOS. (The user can't tell the
difference.) Commercial applications, such as Microsoft Word version
5.00, were created this way. Because dual-mode applications are
literally two full applications glued together, they tend to be huge.
This technique can be used with programs created with the Microsoft
Basic PDS product. However, one limitation of dual-mode applications
is that the MS-DOS portion cannot contain overlays. Attempting to run a
dual-mode application, where the MS-DOS portion was linked with overlays,
will hang the machine.
Illustration
The following compile and link lines create two dual-mode program
examples, OS2OVL.EXE and OS2NOOVL.EXE. (Source code is not provided
but you can write it easily). OS2OVL.EXE is an OS/2 program and
includes an MS-DOS stub program that uses overlays.
WARNING: Running OS2OVL.EXE will hang your machine, requiring you to
reboot.
OS2NOOVL.EXE is an OS/2 program, with an identical MS-DOS version of the
program enclosed as its stub file. OS2NOOVL.EXE does not use overlays,
and will run without problem under MS-DOS or OS/2.
To compile and link the hypothetical programs, use the following
commands:
bc dosprog.bas /Lr /o ;
bc mod1.bas /Lr /o ;
bc mod2.bas /Lr /o ;
link dosprog mod1 mod2, dosnoovl.exe ;
link dosprog (mod1) (mod2), dosovl.exe ;
bc dosprog.bas /Lp /o ;
bc mod1.bas /Lp /o ;
bc mod2.bas /Lp /o ;
link os2prog mod1 mod2, os2noovl.exe,,, os2noovl.def ;
link os2prog mod1 mod2, os2ovl.exe ,,, os2ovl.def ;
DOSPROG.BAS is a main program that calls subprograms contained in
separate support modules, MOD1.BAS and MOD2.BAS.
OS2NOOVL.DEF contains the following line:
OS2OVL.DEF contains the following line:
(A LINK.EXE .DEF file is a module definition file that Basic can use
when linking OS/2 protected-mode programs.)