-
Notifications
You must be signed in to change notification settings - Fork 575
Description
Welcome to the second issue of the Rust for Windows newsletter! This newsletter will cover news and events related to Rust for Windows, and particularly the windows-rs project.
I previously published these internally, but I figured as an open-source project that it is just as relevant and useful for developers outside of Microsoft. I am also using GitHub issues for feedback and discussion. This provides a convenient way for developers to be notified of updates and also comment and join the conversation.
Quick links
- Repo: https://github.com/microsoft/windows-rs
- Getting started: https://kennykerr.ca/rust-getting-started/
- Samples: https://github.com/microsoft/windows-rs/tree/master/crates/samples
- Releases: https://github.com/microsoft/windows-rs/releases
- Feature search: https://microsoft.github.io/windows-rs/features/
Learning series
Part 3 of the Rust for Windows video series is now available on YouTube. This is a series for Windows developers wanting to learn how to make the most of Rust on the Windows platform.
- Part 1 - https://youtu.be/MfwtC55eNzU
- Part 2 - https://youtu.be/OTgIthYqWcY
- Part 3 - https://youtu.be/odSTccFy6ZA
Part 3 introduces some more of the individual crates published as part of Rust for Windows. As requested, part 4 will cover the windows-strings crate and various string-related topics.
New crates and notable updates
-
The windows-services crate (0.25.0) introduces a range of powerful updates for supporting different hosting, testing, fallback, and extended commands (Windows service improvements for hosting, testing, fallback, and extended commands #3662).
-
The windows-targets crate (0.53.3) now forwards the
link
macro forraw-dylib
support to the newer windows-link crate rather than implementing it directly (Forwardlink
macro forraw-dylib
support #3670). This is an advance of the breaking change to resolve an ABI compatibility issue (Clarify and test extern abi workaround for variadic function support #3669). -
CoCreateGuid
has been replaced withUuidCreate
to avoid theole32.dll
dependency in order to support more constrained subsets of Windows used by Azure (ReplaceCoCreateGuid
withUuidCreate
to avoidole32.dll
dependency #3656). -
The
windows
crate's "std" feature now enables dependent "std" features inwindows-core
,windows-future
,windows-collections
,windows-numerics
,windows-result
, andwindows-strings
(Thewindows
crate's "std" feature should enable dependent "std" features #3666). -
The WinRT
DeprecatedAttribute
has always been challenging to support in Rust due to the fact that it can be applied to types and/or type members. As you can imagine, this impacts Rust feature generation recursively. Add the complexity of balancing support for calling such APIs (where only some interface methods may be available) and implementing such APIs (where all methods and dependent types are required for a complete implementation). This "deprecated" metadata is only available for a small portion of the overall Windows API surface area, but is disproportionally complicated to support. I mulled over a few different options but ultimately decided that I am just going to remove it entirely as none of the options I've explored over the years work very effectively or reliably. I came to the same conclusion for C++/WinRT. I already filter out larger APIs that are almost or entirely deprecated from the windows crate.
What’s next
Work continues to improve the experience of Rust developers on Windows and more generally enabling and supporting a broad range of programming languages and frameworks by building the tools and services to enable cross-platform toolchains and frameworks to excel on Windows.
This includes a renewed focus on metadata for the canonical description of APIs and components, whether they ship inside the OS or in some other way. Metadata is the key to scaling up the generation of bindings for various languages including Rust. We must make it easier for app developers as well as language, library, and framework maintainers to approach Windows APIs so they can take advantage of what is distinctive and unique about Windows and light up those features as they are available.
Work has begun, particularly with the first complete ECMA-335 reader and writer for Rust. This gives us the ability to both read and write what are commonly referred to as .winmd files, popularized by .NET and WinRT, for describing APIs and components and has been extended to describe traditional Win32 and COM APIs as well.
The next steps include C/C++ header and IDL parsers that can generate high quality metadata so that we can more easily generate bindings for existing APIs that predate metadata. I am bringing up both an IDL and a RDL parser in tandem. The latter is an IDL dialect but based on Rust syntax and natively embeddable so that we can more easily support first-class component and API authoring in Rust without resorting to what is otherwise the very proprietary syntax that is IDL. The C/C++ header and IDL parsers will likely be somewhat tactical as those dialects are extremely complicated and extremely elusive respectively. The goal is to help developers bring older APIs and definitions forward to a supportable and open-source foundation.
With comprehensive metadata and API or ABI tooling easily accessible to Windows developers, the next step is to make Windows more accessible to non-Windows platforms by providing cross-platform fallback implementations of the various core windows-rs
type system and support crates. This should allow developers to use the same languages and tools to build components and applications that necessarily communicate and interop across operating system boundaries. The windows-rs
technology already supports this to some degree by allowing DirectWrite and DWriteCore, implemented with windows-rs
, to support both Windows and non-Windows platforms. This is today limited to a thin slice of COM support but I hope to extend this to more of the foundational type system so that richer APIs can seamlessly work across different target platforms.
Wrapping up
And that's all for this update. Let me know what you think? What would you like to see more of? Are you interested in specific learning series topics? Are you using windows-rs
today? Let me know so we can continue to prioritize investment in these tools and services.