Thunk: Build Rust Program to Support Windows Xp, Vista and More
Posted4 months agoActive4 months ago
github.comTechstory
calmpositive
Debate
20/100
RustWindows XpLegacy SystemsCompilers
Key topics
Rust
Windows Xp
Legacy Systems
Compilers
The Thunk project allows building Rust programs to support older Windows versions, sparking discussion on compiling Rust for legacy systems and other retro computing topics.
Snapshot generated from the HN discussion
Discussion Activity
Active discussionFirst comment
13h
Peak period
16
66-72h
Avg / period
7.7
Comment distribution23 data points
Loading chart...
Based on 23 loaded comments
Key moments
- 01Story posted
Sep 1, 2025 at 1:57 PM EDT
4 months ago
Step 01 - 02First comment
Sep 2, 2025 at 2:56 AM EDT
13h after posting
Step 02 - 03Peak activity
16 comments in 66-72h
Hottest window of the conversation
Step 03 - 04Latest activity
Sep 4, 2025 at 4:23 PM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45095002Type: storyLast synced: 11/20/2025, 2:52:47 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Shows how little I know. :(
but you're right, win16 can only load some 32-bit PE files through something like Win32s
LLVM's x86 backend doesn't really support 16-bit compilation (the best it gets to is supporting 32-bit in a 16-bit code segment). There's also no support for the Win16-based object file formats. So you'd probably be best off creating your own entirely new backend for a Win16 environment... which probably is easier than you'd think, given that you could ignore anything more complicated than the actual Intel 386 or 486 ISA. (I've actually started sketching out what the IR for such a backend would look like, mostly in terms of LLVM address space mappings).
Win16 is also kind of hard to target for Rust because it's a segmented memory model, and Rust's pointer model doesn't really cope with that well--it only supports one pointer type, and also requires that sizeof(ptr) == sizeof(usize) which is questionable for far pointers. If you're writing your own backend, you could just map everything to huge pointers at the programmer level and have optimization passes that convert them down to far or near pointers if sufficient.
Or you could stuff all of that, and just make a 32-bit app and wrap it in a shell loader that thunks all of the OS calls to 16-bit calls and vice-versa.
I also wanted zig for ncdu2.
I admit I haven't looked too hard, macports has most of what I need still covered. It's always a sad day on my older hardware when I don't have brew auto-update disabled and a MacOS version goes out of support.
enjoy
Unless you mean NT3.1 of course :^)
* Rust9x: Compile Rust code for Windows 95, NT and above: https://news.ycombinator.com/item?id=31112273
* Rust on MIPS64 Windows NT 4.0: https://news.ycombinator.com/item?id=29240174