Skip to content
Dennis Duda edited this page Jan 1, 2024 · 32 revisions
winxp

Blazingly fast! Y2k compliant! Works everywhere!


Rust9x brings most of the Rust standard library to all 32-bit Windows versions. Currently, it is based on Rust 1.76.0-beta.

Sample application

Depending on how far back you'd like to go, there are lots of limitations to keep in mind. Please have a read!

Please note that this is not stable software at all. Do not expect all rust crates to work without issues on Windows 95! Only minimal testing has been done - please feel free to file issues or PRs if you're crazy enough to test this :)

Most of the fallback/workaround implementations were able to be implemented in a "proper" way (i.e. not checking for Windows version, but actual API availability). So far only 9x/ME needed some specific "is this not NT?"-checks to prevent unneeded extra calls that are known to fail anyways.

Installation

Please note that the compiler is compiled for regular x86_64-pc-windows-msvc, so it still has roughly the same requirements as a regular rust install. It is a cross-compiler for rust9x only.

  1. Download the release 7z file you want from the Releases section.
  2. Unpack it to a folder and run rustup toolchain link rust9x path\to\the\foler
  3. Have a look at how the sample application configures search paths and linker arguments, and how it uses a justfile to some of the extra work.

Compiling Rust9x yourself

  1. Clone this repo, check out the rust9x branch.
  2. Copy config.rust9x.toml to config.toml, edit to suit your needs. Or, if you just want to build it, pass --config config.rust9x.toml to the x.py calls below
  3. python x.py build and grab a coffee.
    • If you're changing only the stdlib, you can use python x.py build -i library/std --stage 1 --keep-stage 0 in future builds to only rebuild the standard library.
  4. (Only once) Link the built toolchain to the name rust9x, e.g. for a stage 1 build: rustup toolchain link rust9x D:\your\path\to\rust9x\rust\build\x86_64-pc-windows-msvc\stage1
  5. You can now use cargo +rust9x <command>/rustc +rust9x <...> to use the new toolchain with the new targets:
    • i586-rust9x-windows-msvc: default target-cpu: pentium
    • i686-rust9x-windows-msvc: default target-cpu: pentium4 (SSE2)
    • x86_64-rust9x-windows-msvc: should work for x64 builds of Windows XP and up (untested)
    • Alternatively you can rustup override set rust9x in your workspace folder. You might need to build the other tooling (rust-analyzer, rustdoc, clippy, ...) or set up your workflow to instead use another toolchain's tools, e.g. in the VSCode config for the rust-analyzer extension.
  6. Have a look at how the sample application configures search paths and linker arguments, and how it uses a justfile to some of the extra work.

Requirements

In general, any platform libraries/SDKs that has .lib files that are compatible with the modern MSVC toolsets' linkers should be fine. Static linking should always work, dynamic linking might need additional steps.

Note that panic unwinding needs at least the VC8 (Visual C++ 2005) libraries. If you know why or find a fix, please submit a PR!

The VC7.1 toolset (Visual C++ 2003) is the last version to officially support Windows 95. Way earlier in the project I've tested VC6 (Visual C++ 6.0 SP6), which also worked somewhat fine after adding unicows.lib from a later toolset/platform SDK.

Building programs for 9x/ME and NT-based systems

As Rust follows Unicode Everywhere, a compatible unicows.lib has to be linked in order to enable support for Wide APIs on these systems. See the sample application on how to do this correctly - the README.md, justfile and the .cargo/config.toml all have information/comments inside!

The last unicows.lib version that officially supports Windows 95 is from "Microsoft Platform SDK February 2003" (download link on Wikipedia)

Building programs for NT-based systems only

Same thing as 9x/ME, but you can skip the lines regarding unicows.lib.

Runtime requirements

A Rust9x executable has the following minimum requirements:

  • Windows 95 or Windows NT 3.51*
    • * I've only tested Windows 95 and up, and NT 3.51 and up, though there should not be any static API dependencies left to prevent earlier NT versions from running. Just make sure to lower the subsystem version to 3.10 (not 3.1) if you'd like to target NT 3.1 or 3.5.
    • Windows 95 needs the "net" packages installed (mpr.dll) as the Microsoft Layer for Unicode requires this.
    • Make sure to link against an MSVC toolset that is compatible with your target system. If you're linking the CRT dynamically, keep in mind that you might have to provide the runtime DLLs as well.
  • If network API is used: Windows 95 with the WinSock 2 update or Windows NT 4.0 (Microsoft never released WS2 for 3.51 or earlier)
  • For 9x/ME: As Rust follows Unicode Everywhere, the Microsoft Layer for Unicode runtime DLL unicows.dll should be supplied alongside the executable.
  • For backtrace support, dbghelp.dll must be provided (see limitations)

While the executable and Rust standard library mostly work fine, there are some APIs are not available on older Windows versions - see the Limitations page for all the details.

rust9x-sample in action (rust9x-1.61.0-beta)

All these run the same binary (except NT3.51). The non-network binary runs on all of them, of course.

Windows NT Workstation 3.51 (VM, with network feature disabled as there is no WinSock2 available)

win351

Windows 95 B (real hardware, my Pentium MMX 233MHz machine <3)

win95

Windows XP SP3 (real hardware)

winxp

Windows 11 Pro Insider (real hardware)

win11