TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Microsoft Opens Up Old Win32 APIs to C# and Rust

105 点作者 rsecora超过 4 年前

8 条评论

logbiscuitswave超过 4 年前
Clickbait title isn’t really accurate. You’ve always had this ability by using P&#x2F;Invokes, but it’s never been easy. It requires a lot of domain knowledge (or copy-pasta that may cause other problems) to actually get it to work. It’s also very easy to get wrong and cause big memory leaks in the unmanaged heap.<p>Over the years I’ve managed to get pretty good at P&#x2F;Invokes to the point where I don’t bat an eye when I need to do some interop with native code. That doesn’t mean I don’t sometimes run into a particularly finicky API that requires digging deep into stuff like GC pinning, structure packing, fixed pointers, or other challenges that will grind things to a halt while I debug what’s happening. At least I’ve come to the point where I can look at unexpected API behavior and have a good intuition for what I need to do.<p>It sucks, a lot.<p>I’m really glad that there’s finally an official and reusable abstraction to make this simpler in the future.
评论 #25885604 未加载
评论 #25885918 未加载
评论 #25886689 未加载
评论 #25886389 未加载
评论 #25896835 未加载
simplicio超过 4 年前
The first two paragraphs are wrong, aren&#x27;t they? My understanding is that the &quot;32&quot; in Win32 was originally to distinguish 32 bit from 16 bit API calls, but now its just the generic name for the Windows API.<p>The article makes it sound like the change is only of interest if you&#x27;re compiling 32-bit applications.
评论 #25885916 未加载
评论 #25885876 未加载
userbinator超过 4 年前
It&#x27;s funny to see MS do this after all those years of messing around with various other bloaty UI frameworks... and further reaffirms my decision to stay with pure Win32.<p>Perhaps MS is encouraging developers to native UI after all.
评论 #25886696 未加载
jarjoura超过 4 年前
There is a performance penalty when accessing APIs over WinMD and that is acceptable when you&#x27;re only using them sparingly. I&#x27;d be curious how using Win32 APIs over WinMD performs instead of using PInvoke or FFI.<p>Edit: Here is the actual project if anyone is interested in following along. <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;win32metadata&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;win32metadata&#x2F;</a>
评论 #25886649 未加载
评论 #25886380 未加载
quelsolaar超过 4 年前
This is awesome news. We need platforms to be language agnostic. The best way to do this it to make it possible to query the entire API so that you can automate the warping of other languages.<p>Apples Coca APIs can be queried, and at one point i considered writing a C API generator. My guess it would take a week or two, but at the time I was busy and spending 2 weeks in XCode, wasn&#x27;t really my idea of good time. Some one should do it.
rkagerer超过 4 年前
This may be several years late but is nonetheless great news!
unnouinceput超过 4 年前
Microsoft should bite the bullet and simply create another operating system, created from scratch. They have the experience and the know how to avoid all the mistakes. Offer them in parallel, keep a virtual machine (an Wine equivalent if you want) that would run Windows programs and overall simplify the API&#x27;s while only the new one would receive new developing. And in 10 years Windows would be history. I know it won&#x27;t happen but once can only dream though.
评论 #25888527 未加载
29athrowaway超过 4 年前
For widgets and windows... I prefer to use GTK, which has a much easier learning curve, and works on multiple platforms, and works well with HiDPI.<p>Win32 uses hungarian notation, which is not common these days. The thing was designed for a time in which programming tools had almost no autocompletion and were slightly better than a text editor.