5 ms·
Rust9x: Compile Rust code for Windows 95, NT and above
- pavon 4y agoI wonder if this might be even more useful for ReactOS, which is still actively supporting 32-bit x86, while Windows 11 no longer does.
- andai 4y agoYou spooked me that Win11 had dropped support for 32-bit applications, but it seems they still work fine. There's no 32-bit version of the OS though.
- dataflow 4y agoYeah they worded that confusingly. That said, I feel like the writing is probably on the wall for 32-bit. My guess is this might be the real reason why they pushed for making Visual Studio 64-bit.
- drbawb 4y agoRather confusingly the death of the 32-bit version of Windows in practice just means they are dropping support for 16-bit DOS applications. There is a WoW (windows on windows) subsystem which permitted you to either run 16-bit binaries on your 32-bit system, or 32-bit binaries on your 64-bit system; but there's no 16-on-64 or 16-on-32-on-64. If you have a 64-bit version of Windows the compatibility layer[1] lives at `%SYSTEMROOT%\SysWoW64`. [1]: https://en.wikipedia.org/wiki/Windows_on_Windows https://en.wikipedia.org/wiki/Windows_on_Windows
- simcop2387 4y agoYou can use winevdm for this though, https://github.com/otya128/winevdm https://github.com/otya128/winevdm
- sidewndr46 4y agoI'm waiting for the day when people run Linux on windows via a hypervisor to run old programs under wine. This is pretty close.
- Tuna-Fish 4y agoPeople already do this. There is a very old strategy game (Stars!) that still (barely) has an active community. As it's a 16-bit windows app, the standard advice on how to run it on modern systems is to run it under wine in a VM.
- amalcon 4y agoI actually have already done this -- or, rather, helped someone else to do this. The individual in question was an academic with a license for a rather old version of a particular piece of domain-specific software, which would only run on Windows 95/98/ME. As he taught at a small school, his budget wasn't exactly infinite, so he kept an old Windows 98 machine around to run that software. Turned out, it ran great on Wine. Actually, the performance even improved because the hardware was so much newer.
- toast0 4y agoI used to read about wine for windows, but I haven't seen anything in a while (but there is winevdm, which might be wine for windows for 16-bit)
- albrewer 4y ago> There is a WoW (windows on windows) subsystem Oh my god, I always wondered why the WOW6432NODE registry key was named that but was never bothered enough to look it up. Thank you for triggering the random insight.
- nazgulsenpai 4y agoI commend you for finding a use-case for this because I'm scratching my head over if this is a toy project or filling some necessity. Still a very awesome project!
- seritools 4y agoCan confirm, toy project. But hey, if it helps someone who might actually need this, even better!
- seritools 4y agoJust grabbed the latest ISO to test it out :) - rust9x_sample.exe sadly only works in 98/Me compatibility mode. https://i.imgur.com/nWCfTtV.png https://i.imgur.com/nWCfTtV.png In regular mode it seems there's a problem with the system not setting the file pointer to the end when OpenOptions::append is used: https://i.imgur.com/vvbEnWh.png https://i.imgur.com/vvbEnWh.png https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#met...
- jeroenhd 4y agoThis sounds like you've found a bug in either the Rust standard library or the ReactOS API implementation. It might be worth looking into this!
- seritools 4y agoTo clarify, it works in 98/Me mode because I added a fallback implementation to Rust9x for these systems, as the flag in question is not supported. AFAICT it is supported since NT 3.1, though, and it worked fine on all NT-based systems I've tested so far, so my guess would be a ReactOS API bug. The commit adding the 9x/Me fallback implementation: https://github.com/rust9x/rust/commit/3a3eddb0044c6d03357a75433d938ce07a8c047b https://github.com/rust9x/rust/commit/3a3eddb0044c6d03357a75...
- WhyNotHugo 4y agoThis is a really interesting point. I can imagine that being able to use Rust for ReactOS (and wine!) would bring lots of interesting opportunities for developers and new contributors.
- melony 4y agoHow did you generate the Visual Rust cover image? I love it.
- seritools 4y agoVector graphics tool and manually changed the kerning on each letter to match the OG Visual Studio covers. The background effect is just the regular rust logo copied twice :)
- q3k 4y agoSeeing that splash screen really tickled my brain. It’s likely rose tinted glasses, but I really miss the Visual C++ 6 on Win9x experience and all its associated aesthetic.
- YakBizzarro 4y agoNext step: Windows 3.11 using the win32s API :)
- seritools 4y agoOh trust me I've thought about that :) It depends on two things: - is the supported API surface big enough? - is there an msvc runtime that can be linked with a somewhat modern linker (so that rust/llvm don't get angry) but that still works under Win32s. I'm not sure that exists, though :c
- userbinator 4y agoBiggest difference would probably be the complete lack of multithreading.
- Dwedit 4y agoI know that Win32s requires that the EXE have a RELOC section, so it must be built with relocation enabled. I hope you don't need to go all the way to /NODEFAULTLIB though, that kind of configuration is a big headache to build on. Is there a .lib file for "msvcrt.dll" that will work with /NODEFAULTLIB? If so, I wonder if there is a Win32s compatible binary for that.
- seritools 4y ago> that kind of configuration is a big headache to build on Not really, I've done just that (though in the end I didn't need full /NODEFAULTLIB): https://github.com/rust9x/rust9x-sample/blob/main/.cargo/config.toml https://github.com/rust9x/rust9x-sample/blob/main/.cargo/con... With older msvcrt libraries you only need to link `libcmt.lib`/`msvcrt.lib`, that's it. Visual C++ 4.0 is apparently the last version to support Win32s, so if you can make it link to its libraries you might have a chance!
- Snitch-Thursday 4y agoVery cool, I love the idea of feeding some rust code to my retirement community of old PCs, native PEs that I don't have to use Win32 and C to use.
- zozbot234 4y agoHopefully we'll get support within Rust/Cargo for easily rebuilding the rust-std from source with custom features as part of compiling a project. Then this legacy system support could simply become part of the official Rust distribution.
- cylon13 4y agoThis is already pretty easy with -Zbuild-std, but requires nightly unfortunately. You need to do this to get simd support in the standard lib in wasm for instance.
- zozbot234 4y agoI think the rust-std code added for this project could already be pulled into rust, then. The target names should probably be something like i586-windows-msvc-old. (BTW, if LLVM supports building for plain i386 or i486, support for this should also be considered.)
- estebank 4y agoAlthough I find it unlikely it would get upstreamed (but would love if it was), I think it could be called i586-windows-msvc-chicago instead.
- algesten 4y agoI approve of ureq being used on Windows 95 :) (I'm the original author)
- seritools 4y agoHeck yeah! Thanks for writing it!
- accountofme 4y agoThank you for ureq! And thank you for keeping it async less :)
- Dwedit 4y agoThis looks really neat! I wonder if it has been tested on Win32s or HXDOS. HXDOS is very friendly about that kinds of program it accepts, for example, the console version of 7-zip will run fine on HXDOS.
- seritools 4y agoIf you go `no_std` I'm confident both would work - I think the current windows stdlib implementation still might be too much for those.
- aaaronic 4y agoThis reminds me that I keep meaning to see how much Rust toolchain support there is for legacy consoles like the GameBoy Advance.
- giancarlostoro 4y agoThe FreePascal Compiler does and a bunch of platforms I probably will never run any code I write on.
- shepmaster 4y agohttps://github.com/rust-console/gba https://github.com/rust-console/gba
- aaaronic 4y agoThanks for the link!
- gigel82 4y agoOk, now do DOS, with IPX networking
- zozbot234 4y agoDOS with DPMI would be relatively easy. 16-bit support (real mode or protected mode on 80286) would require significant changes in LLVM, impacting frontend as well as backend code due to the requirement for separately defined _near, _far and _huge pointers and different "memory models".
- anyfoo 4y agoNeeds to be 386 and up with DOS extender then, but sounds fun…
- stuaxo 4y agoWow, I wonder if these will work in DOS via the HX DOS Extender ?
- seritools 4y agoHaven't looked into it too much, but yes, the files themselves should be compatible. I'd probably use no_std on targets like this or Win32s.
- stevefan1999 4y agoI wonder is there any option for async for NT-based legacy system like 2000 or XP? They have fibers and preliminary multicore support far as I remember. On other platforms slapping a simple single threaded runtime is probably fine.
- seritools 4y agoNT has always been an SMT system, so full-on tokio should probably be runnable with a bit of patching.