www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - hybrid MS-DOS/Win32 exe?

reply "Jay Krell" <jay.krell cornell.edu> writes:
Um..I've always wanted to easily write like something that just uses stdio
and runs as a 32bit extended DOS app under MS-DOS but a Win32 app under
Win32? Could this be done, easily? I understand there are at least two
options -- compile and link everything twicing, using the 32bit extended DOS
app as the "stub" for the Win32 app, or some very special startup code and
.exe file formatting such that you achieve object code sharing.

I know there's a DOS extender that implements a subset of Win32 and runs PE
files but I found it had a strong tendency not to work..I also found it kind
of scary that it contains a PE loader written in /assembly/..

 - Jay
Jun 22 2002
parent "Walter" <walter digitalmars.com> writes:
It's pretty easy. Just build a regular DOS executable (or even a DOSX one!),
and then list that executable as the "stub" executable for your Win32
executable. You'll then have one very large exe file that is a dual mode
app. I used to do this all the time.

It works so well I don't see any point to trying to kludge a win32
executable to run under a dos extender.

"Jay Krell" <jay.krell cornell.edu> wrote in message
news:af1nuk$1f8j$1 digitaldaemon.com...
 Um..I've always wanted to easily write like something that just uses stdio
 and runs as a 32bit extended DOS app under MS-DOS but a Win32 app under
 Win32? Could this be done, easily? I understand there are at least two
 options -- compile and link everything twicing, using the 32bit extended
DOS
 app as the "stub" for the Win32 app, or some very special startup code and
 .exe file formatting such that you achieve object code sharing.

 I know there's a DOS extender that implements a subset of Win32 and runs
PE
 files but I found it had a strong tendency not to work..I also found it
kind
 of scary that it contains a PE loader written in /assembly/..

  - Jay
Jul 01 2002