[comp.os.os2.programmer] Can OS/2 executables be built under DOS?

jrbd@craycos.com (James Davies) (11/02/90)

Is it possible to compile and link an OS/2 executable under DOS 3.3?
I have Microsoft C V5.1.  The distribution includes OS/2 libraries,
and implies that the same linker is used for both systems.  I thought
that I would be able to just link with the OS/2 libs and startup code,
then do a BIND on the result to produce a .EXE file that would work
both on DOS and OS/2, but it doesn't seem to be working out that way.
(The manuals haven't been real helpful - the OS/2 stuff was apparently
added as an afterthought.)

Am I trying something impossible here?  Thanks in advance for any advice...

						Jim Davies
						jrbd@craycos.com

dans@microsoft.UUCP (Dan SPALDING) (11/05/90)

In article <1990Nov2.152618.3790@craycos.com> jrbd@craycos.com (James Davies) writes:
>Is it possible to compile and link an OS/2 executable under DOS 3.3?
>I have Microsoft C V5.1.  The distribution includes OS/2 libraries,
>and implies that the same linker is used for both systems.  I thought
>that I would be able to just link with the OS/2 libs and startup code,
>then do a BIND on the result to produce a .EXE file that would work
>both on DOS and OS/2, but it doesn't seem to be working out that way.
>(The manuals haven't been real helpful - the OS/2 stuff was apparently
>added as an afterthought.)
>
>Am I trying something impossible here?  Thanks in advance for any advice...

What you need to do is compile the modules with the /Lp switch and link
with the os/2 libs (?libc?p.lib)

To produce a bound executable that runs on both os/2 and dos, you need to
produce an os/2 executable first.  the binder (bind.exe) then can be used to
produce the bound executable.

Hope this helps.  I know that the info is in the c5.1 ref man somewhere,
probably not easy to find, (*sigh*) but should be in the new section that
explains some of the new features of the c runtime for os/2.

prk@planet.bt.co.uk (Peter Knight) (11/05/90)

jrbd@craycos.com (James Davies) writes:

>Is it possible to compile and link an OS/2 executable under DOS 3.3?
>I have Microsoft C V5.1.  The distribution includes OS/2 libraries,
>and implies that the same linker is used for both systems.  I thought
>that I would be able to just link with the OS/2 libs and startup code,
>then do a BIND on the result to produce a .EXE file that would work
>both on DOS and OS/2, but it doesn't seem to be working out that way.
>(The manuals haven't been real helpful - the OS/2 stuff was apparently
>added as an afterthought.)

>Am I trying something impossible here?  Thanks in advance for any advice...

>						Jim Davies
>						jrbd@craycos.com

Yes, it is.  All you have to do is to include the right run-time library.

Eg SLIBCEP instead of SLIBCER.  To do this, you need to have built the 
library from the distribution disks, and to set the linker flags to get 
the 'right' library. I cannot tell you how to do this, as which library
is the default (SLIBCE) is set when you built the libraries.

Yes, I agree the OS/2 stuff is an after-thought/kludge/panic-measure/
typical-MS-c*ck-up.

Peter Knight
BT Reasearch

#include <std.disclaimer>

Views expressed here are my own, and are not endorsed by my employer.