TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rust for Windows

785 pointsby dsr12over 4 years ago

26 comments

seertaakover 4 years ago
This is really cool. Kudos to Microsoft for really getting open source lately. I wrote an app (which failed miserably) called zenaud.io . When I started writing the app, Apple was hands-down a better developer experience. Now, it&#x27;s the exact opposite -- MacOS is increasingly painful, throwing up more and more roadblocks and constricting their platform ever more. And Visual Studio is better than Xcode IMO.<p>Also, as a C++&#x2F;Python dev - it&#x27;s increasingly hard not to notice the awesome momentum Rust has garnered.
评论 #25863243 未加载
评论 #25864050 未加载
评论 #25863345 未加载
评论 #25865482 未加载
评论 #25864444 未加载
评论 #25865512 未加载
评论 #25863677 未加载
评论 #25870370 未加载
phkahlerover 4 years ago
Rust needed a GUI and Microsoft provided one. They seem to be very focused on giving developers what they need, but only to a point. I&#x27;ve been doing some system glue stuff and while it&#x27;s nice that powershell has ssh an scp they are missing some options I want. I was going to use curses with python (batteries included!), only to find out it&#x27;s not supported on windows.<p>It almost feels like a strategy - be standard enough to bring people in, but idiosyncratic enough to lock them in.<p>I&#x27;ll be using gtk-rs thank you very much.
评论 #25862854 未加载
评论 #25863100 未加载
评论 #25862777 未加载
评论 #25863112 未加载
评论 #25863477 未加载
评论 #25862730 未加载
评论 #25862987 未加载
评论 #25869803 未加载
评论 #25865530 未加载
评论 #25864062 未加载
roblablaover 4 years ago
I was curious how this worked: The previous iteration of this only worked for WinRT API, and this new crate seemed to also work by generating code from WinMD files. But WinMD files only contained definitions for WinRT&#x2F;COM APIs, so how could this possibly work?<p>Well turns out, microsoft started a project to also generate Win32 API information in WinMD file, to generate APIs from them automatically for all native languages! See win32metadata[0]. This could make interfacing with win32 APIs a lot more convenient!<p><a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;win32metadata" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;win32metadata</a>
评论 #25863666 未加载
评论 #25863962 未加载
mwcampbellover 4 years ago
Kenny Kerr&#x27;s blog post on this may also be of interest. In particular, it answers the question I was going to ask about how they&#x27;re handling Win32 and WinRT in a unified way.<p><a href="https:&#x2F;&#x2F;kennykerr.ca&#x2F;2021&#x2F;01&#x2F;21&#x2F;rust-for-windows&#x2F;" rel="nofollow">https:&#x2F;&#x2F;kennykerr.ca&#x2F;2021&#x2F;01&#x2F;21&#x2F;rust-for-windows&#x2F;</a>
评论 #25864163 未加载
Erlangenover 4 years ago
I kind of expect it to be called &quot;Windows for Rust&quot;.
评论 #25862667 未加载
评论 #25864675 未加载
评论 #25862968 未加载
评论 #25866046 未加载
评论 #25862482 未加载
codefloover 4 years ago
As someone who writes Windows software now and then, I’m genuinely excited. I tried using this early, when it was limited to WinRT bindings. It looked promising, but compile times were prohibitive. It seems like they now include a build.rs and have clear recommendations around caching — I hope this solves the problem. Has anyone tried a recent version?
评论 #25862899 未加载
cletusover 4 years ago
The lesson from Microsoft I think is that the fish really does rot from the head. Put another way: who the CEO is really does matter. We have night and day here with Ballmer compared to Nadella.<p>Credit where credit is due: Microsoft has really been doing a lot to try and rebuild their credibility when it comes to the developer community. Off the top of my head I can think of TypeScript, open sourcing .Net, WSL and now this.<p>Oh and they haven&#x27;t done an Oracle or a Cisco (or, let&#x27;s face it, a Google at this point) with their acquisition of Github by letting it die on the vine or with hostile forced integrations.<p>Kudos.
diego_moitaover 4 years ago
For Mac fans, the closest you&#x27;ll have to this in OS-X is core-foundation-rs[1], by the servo team.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;servo&#x2F;core-foundation-rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;servo&#x2F;core-foundation-rs</a>
评论 #25864204 未加载
Thaxllover 4 years ago
For someone not familliar with Windows API, why does creating a Windows needs unsafe and other low level things? I guess it&#x27;s the same for the C++&#x2F;C# version?<p><a href="https:&#x2F;&#x2F;github.com&#x2F;kennykerr&#x2F;samples-rs&#x2F;blob&#x2F;master&#x2F;create_window&#x2F;src&#x2F;main.rs#L15" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kennykerr&#x2F;samples-rs&#x2F;blob&#x2F;master&#x2F;create_w...</a>
评论 #25863419 未加载
评论 #25863429 未加载
评论 #25863631 未加载
Ericson2314over 4 years ago
There is some good stuff here but also some sloppiness.<p>1) Having everyone generate the bindings means there will be many copies of each type, causing type errors. This only works if Windows is always a private dependency, a concept which isn&#x27;t even fully implemented, and that is a bad assumption. Public dependencies are the logical default.<p>2) Putting the proc macro and non-autogenerated parts in the same create is cute but a sloppy conflation of concerns and bad for cross compilation. There is a underlying <a href="https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;windows_macros" rel="nofollow">https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;windows_macros</a> thankfully, but that should be the only way to get the macro.
Animatsover 4 years ago
Will this work when cross-compiling from Linux? That&#x27;s supported by Rust.
评论 #25863642 未加载
评论 #25862787 未加载
jdlygaover 4 years ago
Wow, I thought by the name this would be an awkward Windows distribution of Rust packaged in an MSI. I&#x27;m pleasantly surprised. Microsoft has become one of the best big tech companies for open source in the past few years.
nn3over 4 years ago
Wish there was something like this for Linux too. Rust system programing on Linux consist of dealing with a dumpster fire of badly implemented and incomplete wrapper crates for the kernel interfaces.
评论 #25865720 未加载
tragomaskhalosover 4 years ago
Really pleasing to see that MS have done this without feeling the need to start nailing proprietary extensions onto the Rust language. I feel Rust adoption is still at a low enough level where a separate windows fork would have been especially harmful. I guess there are a couple of factors helping here:<p>- MS were already moving to a model where they prefer to stick with the standards-compliant form of a language: vide C++&#x2F;WinRT<p>- Rust has enough features built in to facilitate this, specifically being able to hook into the compilation process
AndrewGasparover 4 years ago
Since Windows ships a stable ABI, why does this project need to generate the bindings at build time? Couldn&#x27;t all of the bindings be pre-generated, eliminating the build-dependencies?
评论 #25864672 未加载
g051051over 4 years ago
Welcome back, J&#x2F;Direct!<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;J&#x2F;Direct" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;J&#x2F;Direct</a>
评论 #25864862 未加载
mhh__over 4 years ago
D has fairly extensive windows API support, and the usual PE gubbins. Worth taking a look at
评论 #25862946 未加载
评论 #25862721 未加载
评论 #25863066 未加载
评论 #25863002 未加载
评论 #25862930 未加载
sudeepjover 4 years ago
They managed to secure the crate name &quot;windows&quot; [1] which always is a nice touch.<p>I clearly remember that this name was squatted.<p>[1] <a href="https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;windows" rel="nofollow">https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;windows</a>
brundolfover 4 years ago
Very cool to see the start of official support. Unfortunately it looks like it requires unsafe { } for now, though maybe it&#x27;s intended as a low-level foundation on which a higher-level, safer API can be built
评论 #25862489 未加载
评论 #25862706 未加载
评论 #25862761 未加载
评论 #25863873 未加载
评论 #25869237 未加载
skybrianover 4 years ago
Does this automatically generate safe API&#x27;s as expected for Rust? If so, I wonder how they manage it? Did their metadata format have to be extended to describe the constraints on Rust callers and callbacks?
评论 #25864130 未加载
Keyframeover 4 years ago
Any pointers &#x2F; way for cross-compiling on linux for windows?<p>Now Apple for MacOS and iOS, Android and maybe game consoles and Rust is a 1st class citizen!
edkoover 4 years ago
I wonder if this would allow using a WebView2 from Rust? I&#x27;ve searched the repository, but was not able to find it.
评论 #25864543 未加载
type0over 4 years ago
Can we expect to get a better compilation time with this?
评论 #25869156 未加载
daluover 4 years ago
Why would I ever write code on Windows if I don&#x27;t have to because I&#x27;d be writing a Windows program?<p>Microsoft is anti freedom, anti developer.<p>Windows is only good for games. Real development happens on other platforms.<p>They bought github and turned it into something against the spirit of free software. First thing was to add deleting issues and comments.<p>Microsoft is evil. Always had been and if you trust them one bit you&#x27;re a fool
评论 #25882548 未加载
skohanover 4 years ago
This might be an inconsequential niggle, but I kind of dislike the Microsoft&#x27;s approach to naming. Like calling this &quot;rust for windows&quot; makes it sound somewhat grandiose, and maybe as if Rust is somehow endorsing or expanding support for Windows, when it appears to be just a crate which auto-generates wrappers for windows API&#x27;s.<p>The same applies to &quot;Windows Subsystem for Linux&quot; - maybe I&#x27;m alone but to me this sounds more like Linux was getting a bit windows embedded inside it rather than the other way around.<p>Also I find it a bit arrogant that VSCode wants to name-squat the very general term &quot;code&quot; in my PATH. vscode is already quite short and clear, and would have made a perfectly suitable cli name.
Maledictusover 4 years ago
I&#x27;d say this marks the beginning of the `extend` phase.
评论 #25863615 未加载