Skip to main content
Fanael's random ruminations

Archives for topic retro

Current Stockfish on Windows 98?!

Published on the

Topics: retro, windows-9x

A few weeks ago I had this weird idea: would it be possible to make an up-to-date version of Stockfish run on Windows 98? There's an immediate problem with that: Stockfish is written in C++17, which is the still-current, at the time of writing, revision of the C++ language; surely there are no C++17 capable compilers that can still target something as old as Windows 98?

Disclaimer: in this article, by "Windows 98" I mean Windows 98 second edition with the main files of the unofficial service pack installed, which is a convenient bundle of official and unofficial patches. I don't care about Windows 98 first edition, nor the second edition without those updates installed. Note that KernelEx is not needed.

I'm fully aware this has no practical value, but it was a fun thing to do.

As it turns out, the GNU toolchain, comprised of GNU binutils and GCC, the GNU Compiler Collection, doesn't particularly care about all the different Windows versions and will happily output a binary that works on any 32-bit Windows.

The compiler itself, assembler and linker are only a part of a functional compiler package, though. There's one part we're missing: the runtime library, which provides the system-specific program initialization code that runs before the main function. Since we're using GCC, the obvious choice is the mingw-w64 runtime. It also provides Windows API headers, bindings to (pretty much all the extant versions of) the Microsoft Visual C++ standard C library, and a POSIX threading API compatibility layer, winpthreads, which is required for C++ standard threading library support in GCC.

Fortunately for us, a minimal Windows program compiled with GCC with mingw-w64 appears to work fine when executed under Windows 98:

C++
#include <windows.h>

int WINAPI WinMain(HINSTANCE, HINSTANCE, char*, int)
{
    MessageBoxA(nullptr, "Hello world!", "A test", MB_OK);
    return 0;
}

So maybe all we have to do is to compile Stockfish and it will just work on Windows 98…?

Read the full article…