My afternoon hack project was a Rust hello world app for Windows 95. The really cool part is it's cross-compiled from Linux!! No MSVC involvement whatsoever in producing this .exe!
I discovered that lld has built-in support for emitting PE executables, so all I had to do was extract a bunch of headers and link libraries from the Visual C++ 6 SDK and wrap them up in a tiny Rust crate: https://github.com/haileys/vc6-sys
Then, I just wrote some normal Rust code against the Win32 API, pulled in my vc6-sys crate as a dep, and cross-compiled for Windows it using cargo's build-std feature! Here's the source: https://github.com/haileys/win32-helloworld
you literally don't need any custom toolchain on your computer to compile this, just type `cargo build` and it gives you a working exe that works on win95 and up :)
@hailey Caption: screencast of a Windows 95 desktop running in QEMU. A program on the desktop is run by double clicking, which pops up a dialog that says "Hello from Rust!" then another that says "panicked at 'oh no!' at src/main.rs:26:5"
@hailey This is amazing! There's a bunch of people interested in Rust on The Wrong Computers over in https://app.element.io/#/room/#RustRetro:matrix.org.
@hailey also TIL that https://crates.io/crates/cstr is a thing. I've been adding \0 to my C strings and doing run-time checks likes a fool :(
@hailey works on a real PC too (via my VGA capture device...)
this toot blew up over night, got hacker newsed even!
I'm so proud of my little self-hosted-at-home masty instance for serving all those requests for a video toot without having a meltdown :')
hails dot org infra
(all of this just runs in a bunch of nspawn containers on my desktop)