• Multi-Platform Exe?

    From Murray Lesser@1:106/2000 to Mike Luther on Wed Sep 5 13:48:00 2001
    (Mike Luther wrote to Don Guy on 09-04-01, topic: "Multi-platform Exe?")

    I asked this once before, but many moons and many hard
    drive replacements later, I managed to lose the
    information. :-|

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

    Borland Turbo Pascal, I think (but do not know!), but not
    >C++ maybe. Maybe that too .. read on.

    There are a class of programs that are what I think are
    >called Family programs. They will operate in more than one
    >platform. Indeed LOADDSKF.EXE is one of them. Another one
    >is the little AEDIT.EXE which works under DOS,WIN, and OS/2
    >as well in 'native' mode. Let's examine that thought a
    >moment based on what I've researched.

    You may or may not have a copy of the old Microsoft PD7 Developer's
    >kit and the PD-7 compiler. While it would generate code that will
    >work under OS/2 and DOS that's a 16 bit executable only, if
    >my memory of actually doing it is correct. As well, there
    >has been a utilty around for use with the Borland PASCAL
    >compiler for OS/2 and DOS. It will let you combine the
    >executables for DOS and OS/2 into one much larger .EXE
    >file. From my research, it is really a switcher. At load
    >time, it decides that you are executing in DOS or OS/2,
    >then switches to the executable part of the code which is
    >appropriate for either platform.

    You have it almost right, but not quite. OS/2 1.x included a set of
    API calls that were named the Family API (FAPI). OS/2 1.x was a 16-bit
    version of OS/2, and was not very good at running DOS programs; it could
    only run one at a time in real mode (the so-called DOS box). As you
    said, the FAPI calls were the OS/2 API calls that were easily translated directly into DOS API (INT 21h) calls. Programs written for OS/2 1.x
    using only FAPI calls could be converted into "bound" programs, using
    the BIND.EXE utility, and would run unchanged under DOS, Win (including
    early winNT) and OS/2 systems.

    Possibly the best text on the use of the BIND.EXE utility is the
    book by Moskowitz, Ivens, and Bergman: Converting Applications to OS/2,
    Brady Books, 1989, ISBN 0-13-171943-2. This book (long out of print) is
    very good on converting DOS API calls to FAPI calls, and includes a
    section describing what BIND.EXE does to a linked FAPI program to allow
    it to be run as either a DOS or an OS/2 (16-bit) program. A "bound"
    program contains code to "translate" the OS/2 FAPI calls to DOS calls,
    if necessary, at load time. I doubt very much that one could write a
    "bound" program in C++ due to the late binding involved in C++. However,
    I am not an expert on either "bound" programs or C++; I imagine
    David could provide a more authoritative answer to Don's question.

    BIND.EXE was not distributed with BASIC PDS; I have a copy,
    somewhere, that was distributed with an early Microsoft C compiler (v
    5.0, IIRC), but was dropped by MS in 1990 when they picked up their
    marbles and dropped out of the joint OS/2 development program. You
    might still be able to find it on Pete Norloff's OS/2 Shareware BBS,
    although I haven't looked for it.

    I still use BASIC PDS 7.1 to upgrade (on occasion) a couple of my record-keeping programs originally written in 1989-90 (v 7.1 has fewer
    bugs than did 7.0, but still has a couple; unfortunately, MS abandoned
    PDS before it got around to fixing the remaining bugs, even though I had
    told them about a few of them.) I try to keep the old BASIC programs
    current with the changing tax laws. There are compiler switches that determine which object code you get (protected or real mode), but once
    compiled and linked the same executable won't run under both OS/2 and
    "real" DOS. However, either version runs very well in an OS/2, 2.0 or
    later, system; the DOS programs multitask very nicely, each in its own
    VDM. Some of my applications were compiled to run in "native mode"
    16-bit OS/2; others were compiled for DOS--it depended on which set of assembled subroutines I wanted to use in the application. I have one
    DOS-mode "file listing" program I wrote in BASIC PDS (last modified in
    1993) that I use to print out README.TXT files. It has a small bug in
    it that I have given up looking for. Some day, if I live long enough, I
    will port it to PL/I, thereby getting rid of the bug :-).

    Regards,

    --Murray
    <Team PL/I>
    ___
    * MR/2 2.30 #120 * Hindsight is not always 20/20

    --- Maximus/2 3.01
    * Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)