5 ms·
Compiling Rust binaries for Windows 98 SE and more: a journey (2020)
- seritools 3y agoOh hey, author here! The follow-up was discussed here: https://news.ycombinator.com/item?id=31112273 https://news.ycombinator.com/item?id=31112273
- userbinator 3y agoI'm more surprised by the fact that it's nearly 200KB for a Hello World in a non-GC native language.
- pornel 3y agoRust bundles its standard library, instead of having it in MSVCx.DLL. The println macro pulls in a lot of fancy formatting machinery. It also panics when stdout is closed, which pulls in panicking, debug print, and unwinding. This is a one-time cost per executable. Projects for embedded systems typically disable these features to avoid the costs.
- tcfhgj 3y agoI created more complex programs with a much smaller size (without special optimizations) - up to date windows though
- kibwen 3y agoFor embedded work, you can take steps to make your Rust binaries much smaller. I know people who do demoscene in Rust. You can take that Hello World down to triple-digit bytes if such a thing matters for your use case.
- zozbot234 3y agoA useful reference: https://github.com/johnthagen/min-sized-rust https://github.com/johnthagen/min-sized-rust
- tmtvl 3y agoThe interesting part is when I do this: ./hello > /dev/full Does it fail silently? Loudly? Does it pretend everything went well? And most importantly, does it do what it _should_ do, whatever that is?
- pornel 3y agoYou get on stderr: failed printing to stdout: No space left on device (os error 28) and if stderr is borked, you still get an exit code 101 (Rust's code for a panic).
- seritools 3y agoA couple of reasons of the top of my head: - msvcrt linked statically - even when disabling debug and panic unwind, Rust includes the unwind tables in the binary - unicows import library linked