Subj : Multi-platform EXE?
To   : Don Guy
From : David Noon
Date : Wed Sep 05 2001 01:59 pm

Hi Don,

Replying to a message of Don Guy to All:

DG> LOADDSKF.EXE appears to run as a native process, regardless of whether
DG> it is launched from a DOS or and OS/2 command prompt.  Is it possible
DG> to duplicate this with Borland C++ 1.0?

Yes, after a fashion. You will need a separate compiler for the DOS part.
Borland C/C++ 3.1 or Turbo C 3.x will do.

DG>  If so, how?

Let's assume your program is called PROG1 and its source is in PROG1.C

Compile your program PROG1.C for DOS using a DOS C/C++ compiler, and call it,
say, PROG1D.EXE; you can link it initially as PROG1.EXE and rename it when the
build is finished.

Create a module definition file named PROG1.DEF that includes the statement
STUB PROG1D.EXE. Finally, compile your program using Borland for OS/2 and the
module definition file for the link step.

The effect is to produce a .EXE file with 2 complete executables in it: a
16-bit, real-mode DOS version; and a 32-bit, protected-mode OS/2 version. The
DOS loader will not see the OS/2 program, and the OS/2 loader will skip over
the DOS program.

This approach is less than ideal, compared to using FAPI and the DOS-OS/2
binder. But you will need the old 16-bit OS/2 DTK for that, and a compiler that
can produce suitable object code (MS C 5.x/6.x and Watcom C/C++ spring to
mind).

It can be a lot simpler if you use the EMX compiler and the RSX DPMI extender.
This will give you 32-bit code in DOS, as well as OS/2. The code segments will
largely be shared. See my message to Igor Kovac on where to obtain these tools.

Regards

Dave
<Team PL/I>

--- FleetStreet 1.25.1
* Origin: My other computer is an IBM S/390 (2:257/609.5)