using Openwatcom to make a win32s program?
I want to write a game that will run on windows 3.1, and also run on windows 10, so I was thinking of writing a game that when compiled is compatible with the win32s api. I know microsoft compiler products like visual C++, can natively compile a program that will work with win32s. I want to use Openwatcom C++ instead , I don't believe it has compatibility right out of the box to compile a win32s program, what do I need to do to get a win32s compiled with openwatcom? Can I use the Microsoft SDK with openwatcom to write a win32s program?
Comments
I think this is a great goal.
My memory is a bit fuzzy, but I seem to recall that one of the main issues with getting something to compile for or run under Win32s was that it had some special requirements about the EXE format. I forget exactly what it was, but it required something that was optional in NT/9x. So the compiler tools themselves would be very important, even to compile a "hello world".
I seem to recall that the early Watcom compilers had support for Win32s, but I have no idea if this carried on in to the later ones.
With Microsoft compilers, they love to break arbitrary things so you must always design for the latest OSes. Just to build a compatible EXE I would expect you would have to dig out the period-correct compiler version. Thankfully, we have many of those here
Of course, the API sets are another issues. You are limited to a subset that excludes things like multithreading.
Still, a simple 2-d game should be doable in Win32s.
Of course, Windows 10-32 bit can even run Windows 3.1 16-bit applications. But sadly, not too many people use that version.
I'd be interested to hear how this works out.
Did older compilers support preprocessor directives? If so, you could possibly use that to make code that will compile on both while not necessarily running on both. That way you have one code base, but multiple binaries. If the code is then also written portably (i.e. runnable from flash drive, etc), you could use a batch file to bootstrap and run the binary for the current OS. Each binary would then use the same config files, save files and assets.
This would certainly be a fun/frustrating project that I'd love to see a postmortem or dev diary for.
Little update, What I found out is that the latest Open Watcom does actually have support for making win32s programs , which it's not reported in the documentation. Found someone who told me as long as the program only uses what is supported in win32s , the program will run. SomeGuy is mostly right of what he is saying, Like what you say about Microsoft Compilers breaking things, for example The example programs that come with Open watcom , the Win32 examples are Win32s compatible , and the C++ code only uses what is compatible with win32s, But if you convert the files and compile them using a newer compiler like for example the newest microsoft compiler , the program isn't going to run on windows 3.1, even if the source code is designed specifically to be win32s compatible. Compiling on a win32s compatible compiler the program will work, use a newer compiler to compile , not going to work. I am going to test this , to see if a openwatcom C++ sample game with code , if I can get it to run on windows 3.1, if it's compiled using a newer compiler.
Version 1.1 has a version of the CLI tools from Visual C++ 1.0 32bit, that can sure generate 32s code.
I'd probably stick with Watcom 10 or VC 1.0 or 2.0
With a little research visual studio and visual c++ can compile win32s, up to version 6.0 or so , also as long it has a SDK that is at least windows 98 compatible you can actually compile a win32s usually, but the last microsoft visual product that support windows 98 couldn't do win32s though, I think it was the version after 6.0, or after 7.0 .