[HN Gopher] Rust hello world app for Windows 95, cross-compiled ...
       ___________________________________________________________________
        
       Rust hello world app for Windows 95, cross-compiled from Linux, no
       MSVC
        
       Author : sohkamyung
       Score  : 106 points
       Date   : 2023-05-13 11:50 UTC (11 hours ago)
        
 (HTM) web link (hails.org)
 (TXT) w3m dump (hails.org)
        
       | ryao wrote:
       | The title begs the question, how do you compile Rust with MSVC?
        
         | jamesmunns wrote:
         | MSVC is the default compiler backend for Rust on windows. You
         | can also switch to use GCC tho: https://rust-
         | lang.github.io/rustup/installation/windows.html
        
       | garganzol wrote:
       | I just can't help but point out how cool the Windows 95 user
       | interface was. Partially inspired by the NeXT OS, its clarity
       | endlessly resonates with me.
        
         | allochthon wrote:
         | As someone who used Windows 95 when it came out, it struck me
         | at the time as an off-brand Macintosh, making it feel kind of
         | cheap (a feeling that never went away). I had also been using X
         | Windows by way of SGI's workstations around that time, and IRIX
         | felt clean, if a little old-school, by contrast.
        
           | asveikau wrote:
           | 95 felt amazing if you were used to 3.1. I had some exposure
           | to Mac then and I liked it a lot, but somehow I always saw it
           | as a different thing, rather than Windows being a knockoff.
           | (Obviously there was a lot knocked off. It was really funny
           | to me that they introduced a "recycle bin" to copy the Mac
           | "trash".)
        
         | qalmakka wrote:
         | Windows 2000 was the pinnacle of Windows UX, change my mind.
        
         | statquontrarian wrote:
         | Currently running Chicago95 on Linux!
         | https://github.com/grassmunk/Chicago95
        
         | ilrwbwrkhv wrote:
         | I swear. The first thing which came to my mind too. So clear.
         | So precise. Why did we take a worse turn here seriously? Is
         | there any research on this?
        
         | rafabulsing wrote:
         | This is something that I've wondered about before. I've seen
         | many people with that opinion: UIs in the past, although dated
         | looking now, were very intuitive, in that every interactive
         | thing _looked_ interactive.
         | 
         | Contrast that with amorphous, flat, "clean" designs we have
         | today.
         | 
         | So what could we do to have something that looks nice and
         | modern, but is also intuitive, with clear affordances?
        
           | [deleted]
        
           | badsectoracula wrote:
           | > in that every interactive thing looked interactive
           | 
           | I agree in general though i'm not sure Win95 was that
           | consistent. Buttons did look 3D but menus - also interactive
           | - did not. Similarly with the context menu icon at the top
           | left, it was interactive but didn't look like it. Meanwhile
           | Win98 had toolbar buttons become flat.
           | 
           | There was an attempt with Win3.0 (i think) to define a form-
           | follows-function approach where "if something can be
           | interacted with it should be 3D" but even that didn't went
           | far (checkboxes were not 3D nor were edit boxes). By late
           | Win3.1 the ctl3d (i think) DLL was introduced to make
           | everything look 3D regardless of function.
           | 
           | In comparison to today, sure things were better, but it isn't
           | like there was any point in time where things were consistent
           | in terms of control/widget look following its function.
        
             | layer8 wrote:
             | Not every control was 3D, but for example in the menus you
             | had mouseover highlighting that would suggest that you can
             | click the item. And if for some control it wasn't mouseover
             | highlighting, then it was a tooltip or a changing mouse
             | pointer.
        
           | zac23or wrote:
           | I've been in development for 24 years and now I have issues
           | with some very strange UIs. Where do I click to post?
           | 
           | Old UIs are consistent. Buttons are buttons, labels are
           | labels, and so on.
           | 
           | New UIs are inconsistent. In the facebook interface, the post
           | button is not a button, it's a label. It may have changed
           | since I last used it. It also occurs in native programs.
           | 
           | In older UIs, button size makes sense. Today every app
           | recreates the buttons, with absurd sizes.
           | 
           | Contrast. Designers love low contrast in the new UIs. Here in
           | HN it is sometimes very difficult to read the text.
           | 
           | As a developer, I participated in several meetings about new
           | UIs. "Beauty" is the keyword. The beauty seems to be in the
           | rounded corners and the use of labels instead of buttons.
           | Yes, I created a bunch of shitty UIs.
           | 
           | But most importantly, dark patterns don't exist in old UIs.
           | Dark patterns are the worst thing about the new UIs.
        
             | echelon wrote:
             | In the 90's, the concern was teaching new users how to
             | compute. Personal computers for the home were still
             | relatively new, and many people were using them for the
             | very first time. Everyone was concerned with usability.
             | 
             | In the 20's, the concern is onboarding users that already
             | have devices and pay money to use software. We don't think
             | as much about familiarity, teaching, etc.
        
               | zac23or wrote:
               | That's it, perfect.
               | 
               | Perhaps the most important thing is to keep the user on
               | the platform, avoiding his departure as much as possible.
               | Thus, a "unique" interface helps with this.
        
             | bentcorner wrote:
             | Even with old UIs there were definitely mis-use of UI
             | elements. Clickable labels that opened things, buttons made
             | of images. Apps that were basically an imagemap that you
             | clicked on. Think early media apps like Realplayer.
             | 
             | Although I don't know if you'd really classify these as
             | "old UIs" - they were definitely old, and had a UI. You
             | probably mean "use native platform widgets were possible
             | and any new widgets look as native as possible".
             | 
             | But then some apps bridged this gap nicely. Winamp was very
             | "non native" but the default skin was consistent, clean,
             | and fast.
        
               | zac23or wrote:
               | > Even with old UIs there were definitely mis-use of UI
               | elements
               | 
               | Yes, but they were exceptions. Interface Hall of Shame
               | has some examples http://hallofshame.gp.co.at/
               | 
               | > Winamp was very "non native" but the default skin was
               | consistent, clean, and fast.
               | 
               | Visual aside, Winamp follows certain standards. Buttons
               | are buttons, for example.
        
           | forgotmypw17 wrote:
           | Windows 95 was developed over several years with a lot of
           | research and user studies. The primary objective of all this
           | work was so that a person without prior exposure to computers
           | could figure out how to use it. The software was designed to
           | help the user accomplish the tasks they have set out to do
           | before sitting down at the computer.
           | 
           | With most modern mainstream interfaces, both the audience and
           | the objectives have changed. The overwhelming majority of the
           | audience is now computer-literate and can be counted on to
           | figure out how to use the basic features regardless of their
           | quality. And the design objectives for many interfaces have
           | changed to manipulating the users to do what the developer
           | wants them to do, with the user's tasks relegated to a side
           | quest.
           | 
           | Another factor is that Windows 95 was developed for "install
           | it and leave it" operation, with the next upgrade coming in a
           | year or two. A lot of attention to detail was unavoidable
           | because you could not push an update a week after release to
           | patch a bug. At the same time, Microsoft was offering real
           | live person phone support for its products, so every UI flaw
           | cost them a lot in support costs.
           | 
           | Also, one of the design requirements was to fully support
           | only-keyboard operation, and a lot of QA effort went into
           | ensuring this was true. This meant that every UI element had
           | to have a keyboard cue. This duplication of accessibility
           | resulted in a UI which was much more thoroughly evaluated for
           | its efficiency.
           | 
           | Finally, I think there was a different culture around design.
           | I think a higher portion of people in the UI field were there
           | for personal and passion reasons, and would have been
           | embarrassed to have anything to do with the type of
           | blundering buffoon of an interface that is common in today's
           | computing.
        
             | garganzol wrote:
             | Excellent observations and analysis. Thank you. Indeed,
             | there is so much going on under the tip of the iceberg.
        
           | layer8 wrote:
           | I'm sure there are many ways to do a restyling, similar to
           | the Apple Aqua UI [0] for example, that could create a fresh
           | look, while maintaining the clear affordances.
           | 
           | [0] https://en.wikipedia.org/wiki/Aqua_(user_interface)
           | 
           | The issue, I suspect, is that the young UI graphic designers
           | working at Microsoft today mostly didn't grow up using PCs
           | and therefore don't really know what their missing.
        
         | FeistySkink wrote:
         | A full-blown OS with an office suite fit on something like
         | 100MB drive with everything opening and responding to user
         | input in a snappy manner. And it didn't show random ads or try
         | to track your every action. You could chose when and if to
         | install any updates. All the while running on a 486 with a few
         | megs of RAM. How did we get to the current state of software?
         | 
         | Edit: I remember a few places still running 3.11 well into the
         | 00s because it just worked for the given tasks, got out of the
         | way and didn't require a super-computer to run. The performance
         | difference was especially jarring when Vista came out and
         | barely worked on contemporary hardware.
        
           | moonchrome wrote:
           | > How did we get to the current state of software?
           | 
           | You mean how did we get to a point where :
           | 
           | - I don't have to mash Ctrl+s because software crashers
           | constantly
           | 
           | - segfaults are not a daily occurrence
           | 
           | - any random executable can't crash the OS (hell modern
           | windows can survive a GPU driver crash)
           | 
           | - I can use the internet relatively safely
           | 
           | - I don't need to restart my device after every install
           | 
           | etc. ?
        
             | HeladeraDragon wrote:
             | Completely agree. Modern software is so much better than
             | old software. Fuck the "ooh it runs on 100MB of RAM" I
             | don't fucking care. All I care about is that it's so much
             | more reliable than before, I can actually get my shit done
             | now.
        
               | FeistySkink wrote:
               | On rare occasions that I have to boot Windows to run some
               | government-compatible software on a 32-core, 64GB RAM and
               | I-don't-even-care-to-check-how-fast SSD, I have to listen
               | to it firing on all cilinders while Defender fights
               | Malicious Software something and Windows Updates while
               | I'm typing some text in a barely responsive page. Truly
               | getting my shit done.
               | 
               | Edit: Forgot all the random software doing auto updates
               | and notifying me about it as I go.
        
               | moonchrome wrote:
               | That's the price of living in a world where you're
               | connected to the internet by default - a huge amount of
               | performance goes towards security
               | (sandboxing/scanning/rules). Windows 9x didn't even have
               | a firewall FFS.
               | 
               | Windows has to chose defaults for a huge audience, if you
               | daily drove it it would probably just work. Way better
               | than 95 would.
        
           | bitwize wrote:
           | A 486 with a few megs of RAM coukd not run Windows 95 in a
           | snappy manner. It would swap like bugfuck. To do Windows 95
           | usably, you probably need 8 MiB minimum, 12 or 16 MiB
           | ideally.
           | 
           | Windows 3.x you could get away with 4 MiB. And that and
           | Office 1.0 could fit in 100 MiB. Even then, we complained
           | about it.
        
             | FeistySkink wrote:
             | According to Wikipedia, Office 95 required 28 to 88 MB of
             | storage.
        
           | reisse wrote:
           | > How did we get to the current state of software?
           | 
           | Though playing mp3 was a heavy task consuming most of the
           | CPU. It was hard to do anything while listening to music.
           | 
           | Or think about how pressing Ctrl-S once a minute became a
           | reflex, because MS Office crashed so often.
           | 
           | Hell, anyone remembers how unstable Windows ME was? Or how
           | desktop Linuxes were practically non-existent?
           | 
           | Current state of software is _amazing_ compared to what was
           | available at that time.
        
             | thwarted wrote:
             | Two comments in this thread (this one and a sibling)
             | mention needing to save often due to programs crashing, as
             | if reliability of the software is solved by showing ads and
             | tracking activity, or is a function of the size of the
             | program or the speed of the computers or software, the
             | things FeistySkink had mentioned.
        
               | reisse wrote:
               | Not sure about the ads, but telemetry definitely
               | increases reliability. It allows to debug very specific
               | issues with a comprehensive information about user
               | environment. Source: debugged proprietary app multiple
               | times using telemetry information. Sometimes the issues
               | discovered were not reproducible without recreating some
               | very specific environments.
               | 
               | Surely there are downsides to telemetry and tracking, but
               | they can be useful for development.
        
           | photonbeam wrote:
           | Snappy is not what my memory of the IO on those machines was
        
             | mrighele wrote:
             | The IO at the time was terrible, also because,if memory
             | serves me right, plenty of disks/controllers didn't support
             | DMA transfers.
             | 
             | But if you had a few megabytes to spare for caching (not
             | everybody did, for sure) the machines would be snappy,
             | because the UI was.
        
             | FeistySkink wrote:
             | I'm talking about general UI responsiveness. Perhaps this
             | is just nostalgia.
        
               | bitwize wrote:
               | It is. Windows UIs didn't get Amiga levels of responsive
               | until Windows 98SE or so.
        
               | robinsonb5 wrote:
               | And then lost them again during the gap between Vista's
               | launch and SSDs becoming ubiquitous...
        
               | FeistySkink wrote:
               | I had some of the first SLC SSDs. It didn't help at all.
               | Windows 7 was a massive improvement though.
        
               | pengaru wrote:
               | There's some truth to it just for vendor-supported
               | graphics driver reasons alone.
        
               | bluedino wrote:
               | Watching 90's GUI programs is always fun because you can
               | see the graphics as they are drawn, which I don't seem to
               | remember from back then.
        
               | robertlagrant wrote:
               | Now we have spinners that twirl while we wait for
               | graphics to transmit from another continent.
        
               | robinsonb5 wrote:
               | If you're nostalgic for that, there's plenty of modern
               | software with a watch-it-paint-itself UI. <cough _Sage_
               | cough>
        
               | robertlagrant wrote:
               | I have never heard anyone call Sage "modern software"
               | before : - )
        
             | jakewins wrote:
             | Haha I had the exact same thought. I still hear that
             | "brrbrbrrrbrre" of the HDD arm frantically trying to deal
             | with the overload of doing anything whatsoever.
        
               | junon wrote:
               | I do miss the sounds of older, more mechanical machines
               | though. You could be doing something else in the room
               | while your Very Long Task was running, waiting for the
               | silence that signaled it finishing.
        
             | garbagecoder wrote:
             | I don't recall it being snappy and I also recall it being
             | crashy. But it was a lot better than what came before it.
             | Given the hibernation Apple was in at the time, it was the
             | best alternative. Between the 95 launch and OS X 10.3 was
             | the only time I used Windows as my daily driver.
        
               | asveikau wrote:
               | > Given the hibernation Apple was in at the time,
               | 
               | System 7 and Mac OS 8 were pretty good from a UI
               | perspective, but no memory protection and no preemptive
               | multi tasking was not great. For a long time "MacOS 9"
               | was synonymous with classic Mac, but I always remember 8
               | being the last tolerable one, by the time 9 came around
               | the foundations were more clearly inadequate, it was like
               | the WinME of Mac OS, tiding over until OS X.
               | 
               | > OS X 10.3
               | 
               | Yes. I remember some commentary on the first few versions
               | of OS X was that they were resource hogs.
        
             | badsectoracula wrote:
             | 486 was certainly not snappy, though Win95 did technically
             | run even on a 386 with 4MB of RAM (i know because i tried
             | it back when Win95 was new).
             | 
             | However on the Pentium MMX@200MHz with 32MB of RAM i had
             | ~1996/97 it was _very_ snappy. On the same machine i also
             | ran my first Linux, Caldera OpenLinux 2.3 in 1999, with
             | KDE1 where it also felt very fast.
        
               | alexeldeib wrote:
               | I find it hard to believe _disk_ was snappy compared to
               | modern devices, since original comment mentioned IO. Cpu
               | /memory are down to program behavior in addition to hw.
               | Disk, more size and hw. And HW improvements have dwarfed
               | size increases (rather, facilitating them to some
               | degree).
        
               | FeistySkink wrote:
               | There was plenty of software and games that could fit on
               | a floppy or two.
        
             | bluedino wrote:
             | Fast on a Pentium 75, dreadfully slow on 486/25
        
         | airstrike wrote:
         | Not to mention those beautiful tiling wallpapers. I'm partial
         | to the simplicity of the blue rivets, though it may just be
         | nostalgia...
         | 
         | https://windowswallpaper.miraheze.org/wiki/Windows_95
        
         | codegeek wrote:
         | Windows 95 and 98 are one of the best things that I have ever
         | come across when it comes to Software.
        
           | tmountain wrote:
           | What about the regular crashes that always happened at the
           | absolute worst time possible? For me, Windows 2000 was a
           | godsend from a stability perspective. I ran it until it was
           | truly no longer viable.
        
       | kragen wrote:
       | if you're interested in cross-compiling win32 programs from linux
       | without msvc you might be interested in
       | http://canonical.org/~kragen/sw/w32dry/
       | 
       | i wrote this 15 years ago but it still works on this recent
       | ubuntu system if you supply a couple of variables to make
       | make run CC=i686-w64-mingw32-gcc WINE=wine
       | 
       | no rust tho
       | 
       | in debian/ubuntu the package to install to get
       | i686-w64-mingw32-gcc and the attendant header files and libraries
       | is gcc-mingw-w64-i686
       | 
       | amusingly the executables i built 15 years ago still run on
       | current gnu/linux; not sure if that would be true for things
       | linked with libx11 and libxext, certainly not libgtk
        
         | csdvrx wrote:
         | Wow, fantastic!
         | 
         | > amusingly the executables i built 15 years ago still run on
         | current gnu/linux; not sure if that would be true for things
         | linked with libx11 and libxext, certainly not libgtk
         | 
         | win32 is how you write software you want to run forever thanks
         | to the large user base.
         | 
         | I'm hoping for a wine cosmopolitan binary that would render to
         | sixels: that would run on about everything, with qemu ensuring
         | it keeps working if/when arm64 or mips64 take over amd64
        
           | kragen wrote:
           | glad you enjoy it!
           | 
           | sixel is not very widely supported, and the baud rate of a
           | vt340+ is not really adequate for a gui
        
             | csdvrx wrote:
             | I can play videos with mpv and a sixel output, so I think
             | the framerate could be enough with some minor tweaks (like
             | how RDP does)
        
       | mhd wrote:
       | I'm assuming cross-compiled from a way more modern computer. Or
       | could a Pentium I complete a Rust run?
        
         | estebank wrote:
         | I would guess that the first problem you'd encounter is getting
         | LLVM to work on that Pentium I.
        
         | 3836293648 wrote:
         | IIRC you can run rustc on ancient hardware if you compile it
         | yourself. You can't however, compile the compiler on 32 bit
         | hardware due to the 4GB RAM limit
        
       | Dwedit wrote:
       | The problem with Windows 9x is the 'ANSI' APIs everywhere, and no
       | support for Unicode.
       | 
       | Oddly enough, we are actually going backwards from using the
       | UTF-16 APIs back to using 'ANSI' APIs, and simultaneously setting
       | the process code page to UTF-8. Any time you use ANSI APIs, there
       | is a hidden conversion step (allocation, conversion, copying)
       | where your text is converted into UTF-16.
        
         | josephcsible wrote:
         | > The problem with Windows 9x is the 'ANSI' APIs everywhere,
         | and no support for Unicode.
         | 
         | Didn't you just need to install
         | https://en.wikipedia.org/wiki/Microsoft_Layer_for_Unicode aka
         | UNICOWS.DLL to fix that?
        
       | Animats wrote:
       | It's quite possible to develop in Rust for Windows without using
       | Windows.
       | 
       | Try my open source "ui-mock".[1] This is a test of the cross-
       | platform stack. Just get the repository with "git clone", and
       | make sure you have Rust installed for target "x86_64-pc-windows-
       | gnu". See the Cargo.toml file for build instructions.
       | 
       | This is a game-type user interface. It's just some menus and a 3D
       | cube. It doesn't do much, but it exercises all the lower levels.
       | This allows debugging cross-platform problems in a simple
       | environment. The main crates used are winit (cross-plaform window
       | event handling), wgpu (cross-plaform GPU handling), rfd (cross-
       | platform file dialogs), keychain (cross-platform password
       | storage), egui (Rust-native menus and dialogs), and rend3 (safe
       | interface to wgpu). For graphics, it uses Vulkan, so it will run
       | on Windows back to the last release of Windows 7. Not Windows 95,
       | though; it's 64-bit. It will also run under Wine, so you don't
       | even need a Windows system to test.
       | 
       | My metaverse client uses the same stack. It's compiled on Linux,
       | and runs on both Linux and Windows. So I'm building a high-
       | performance 3D graphics program for Windows without even owning a
       | Windows system or using any Microsoft software.
       | 
       | [1] https://github.com/John-Nagle/ui-mock
        
         | qalmakka wrote:
         | With xwin you can download a copy of the MSVC sysroot and use
         | it to build Windows applications on Linux. LLVM reimplemented
         | the entire MSVC toolchain and can thus link with MSVC
         | libraries.
        
         | junon wrote:
         | I compile BGFX + SDL2 for use alongside Rust on WSL without
         | using MSVC and can run the generated .exe directly from the
         | command line. Works fine - the package management is a bit of a
         | pain but not terrible (two commands to install dependencies
         | instead of just `cargo build`), but overall it has worked
         | absolutely perfectly.
        
       | weinzierl wrote:
       | Rust officially supports kernel >= 3.2, which is admittedly old
       | enough to cover any real world usage scenario. That being said I
       | wonder if someone tried to get a Rust program (or even better the
       | compiler and toolchain) to run on an old 90s Slackware or
       | something? That'd be an article I'd love to read.
        
       | drewcoo wrote:
       | > No MSVC involvement whatsoever
       | 
       | > all I had to do was extract a bunch of headers and link
       | libraries from the Visual C++ 6 SDK
       | 
       | Hmm . . .
        
         | [deleted]
        
         | rektide wrote:
         | I wonder whether it's actually legal to extract & independently
         | redistribute these libraries.
         | https://github.com/haileys/vc6-sys/tree/main/sdk/lib
        
           | garganzol wrote:
           | Those files just reflect the publicly available Windows SDK,
           | so it is pretty much ok to extract them - they reflect just a
           | public domain knowledge. Actually, you can even create your
           | own libraries with special tools like IMPLIB.
        
             | criddell wrote:
             | The license says you cannot redistribute the debug version
             | of the libraries.
             | 
             | That's okay though because the build tools are freely
             | available from Microsoft. Don't bundle them - just tell
             | your users where to get them or auto-download them with
             | wget or something like that.
        
               | ComputerGuru wrote:
               | That you can't distribute the specific compilation of
               | publicly available knowledge is different from
               | recompiling (even all) that same knowledge into your own
               | work.
               | 
               | It's why you can publish and have copyright over a book
               | of quotes from dead people, but no copyright over the
               | individual quotes themselves (which are in the public
               | domain).
        
               | kragen wrote:
               | in the usa (and i think in berne convention countries in
               | general) some quotes are long enough to be copyrightable,
               | and the copyright can last decades after the author's
               | death
        
       ___________________________________________________________________
       (page generated 2023-05-13 23:00 UTC)