» Tech »

SDL and C++ on Windows 95

The download page for ScummVM lists a “Windows 95+ zipfile” release. Huh.

I was intrigued, so I booted a Windows 95 virtual machine and tried to run it. It actually worked.

That is impressive: a graphics-heavy application, written in modern C++, is running smoothly on an operating system that’s almost 30 years old. How did they pull it off? Could I build such an executable as well, preferably from Windows 10?

The answer, of course, is that ScummVM makes use of SDL 1.2 which still supports Windows 95. So that’s easy: just use it.

Then, go find a compiler that spits out 95-compatible executables. Such as MinGW 9.2.0.

With the obstacles out of the way, I decided to write a crappy little test program.

Once the compiler and the environment have been set up, building is just a matter of running something like:1

$ g++ -ID:\Static\SDL-1.2.14\include\SDL
      -lmingw32 -lSDLmain -lSDL
      -o demo95.exe
      -Wall -pedantic
      -static-libgcc -static-libstdc++

Make sure not to forget the last two arguments or Windows 95 will complain about a missing DLL.

Then, squint your eyes, keep your fingers crossed, and move the executable into the VM. Click on it. Tada.

The application running on Windows 95
image credit: balladeluce

I really like this.

As software engineers or hackers, we should try to support legacy systems to a certain extent.2

If you build a game this way, there is a chance that your efforts will directly make someone out there happier. Your game will be useable by people who cannot afford new tech. It will be useable by people who run compatibility layers, such as Wine. Your grandma can run it on her computer.

Do it.

  1. The line has been wrapped for better readability.↩︎

  2. It is very convenient for me to remain vague at this point. However, it really depends: in this case, it's about an offline game and some compiler flags. However, I wouldn't recommend to port control software for a nuclear plant to an Amiga 500. Use common sense.↩︎