Development / Security

This Week in Programming: Microsoft Gets Rusty

24 Apr 2021 6:00am, by

“The Rustening at Microsoft has begun,” tweeted Microsoft distinguished engineer Miguel de Icaza.

What de Icaza is referring to is a newly-offered course by Microsoft on taking the first steps with Rust, which much of the Twitterverse of Rust devotees sees as a sign that the company is further increasing its favor for their crab-themed language of choice. Of course, this isn’t the first we’ve heard of Microsoft looking to Rust to handle the 70% of Microsoft vulnerabilities that it says come from using the memory-unsafe C++ programming language in its software. A few years back now, Microsoft launched Project Verona, a research programming language that takes a bite from Rust in the realm of ownership and is said to be inspired by Rust, among others.

More recently, however, Microsoft announced the preview of Rust for Windows, which “lets you use any Windows API (past, present, and future) directly and seamlessly via the windows crate (crate is Rust’s term for a binary or a library, and/or the source code that builds into one).” With Rust for Windows, developers can now not only use Rust on Windows, they can also write apps for Windows using Rust.

Rust for Windows is a project spearheaded by Kenny Kerr, a principal software engineer on Microsoft’s Windows Developer Platform team, who started the effort to bring Rust to Windows in November 2019. At the time, Kerr, who created the C++/WinRT language projection, wrote that he was “largely satisfied” with how it worked and that “the Windows Runtime has always been about more than just one language and we have started working on a few different projects to add support for various languages. None of these efforts could however draw me away from C++… that is until Rust showed up on my radar.”

Long story short, Rust turned out to be “an intriguing language” that “closely resembles C++ in many ways, hitting all the right notes when it comes to compilation and runtime model, type system and deterministic finalization” and “has the potential to solve some of the most vexing issues with C++’s relationship to WinRT.”

Fast forward to January of this year, and Kerr said he was “excited to finally talk about the grand plan we have been working on for some time, namely the unification of the Windows API. No more Win32 here, WinRT there, COM this, UWP that. Just stop it. Rust for Windows lets you use any Windows API directly and seamlessly via the Windows crate.”

According to the project description, the Windows crate “lets you call any Windows API past, present, and future using code generated on the fly directly from the metadata describing the API and right into your Rust package where you can call them as if they were just another Rust module” and that, along with the introduction of a course for learning Rust, is precisely what has all those Rust devotees so excited.

This Week in Programming

  • Linux GUIs Come to WSL: It’s a bit of a banner week for you folks working with Windows, it seems, as Microsoft has also released an initial preview of Linux GUI app support for the Windows Subsystem for Linux (WSL). WSL gives Windows users the ability to run a Linux environment while booting into Windows, meaning there’s no need to dual-boot, but until now it only offered command-line tools and applications. Now, this highly anticipated and open source feature means that WSL users can run GUI applications, such as VS Code Remote, providing them with “a full-fledged Linux IDE directly on your Windows machine,” as well as other IDEs such as gedit, JetBrains based editors, gvim, and more. The ability to run GUI Linux applications in WSL also means that Windows-based developers can test applications in a Linux environment without needing to change machines, boot into Linux, or run a virtual machine, and Microsoft notes that there’s a bonus feature too: you can use WSL’s GPU access to run Linux applications with 3D acceleration. For more on how all this works, head on over to the blog post and read more (nifty diagram included) or check out the README for installation instructions. Also, check out the demo below:

  • Visual Studio 2022 Goes 64-bit, Gets Accessibility Makeover: Last up for you Microsoft developers out there, the company teased a public preview of Visual Studio 2022, which it says will be released later this year. Visual Studio 2022, they write, will be “faster, more approachable, and more lightweight,” with added features around remote collaboration and, importantly, will be a 64-bit application that is “no longer limited to ~4gb of memory in the main devenv.exe process.” While the company notes that this doesn’t mean that Visual Studio “doesn’t change the types or bitness of the applications you build,” Visual Studio Magazine reports that user reactions were a mixed bag, with a majority of the comments “primarily of ‘what took so long’ nature” while others remarked on the need to update Visual Studio extensions, with the fear that extension authors would never do so. Other features announced with the preview will include updated icons and accessibility features, full support for .NET 6 and its unified framework for web, client, and mobile apps, support for the C++ workload with new productivity features, C++20 tooling, and IntelliSense, as well as support for CMake, Linux, and WSL. While there are too many other features to fully list here, also notable is that Visual Studio 2022 will “include powerful new support for Git and GitHub” as well as features to better work with Azure.

  • NumPy, Perl, Julia Among Google’s Season of Docs Participants: It’s time for Google’s yearly Season of Docs initiative, which pairs open source organizations with technical writers to create better documentation (something we can all get behind, right?) and the project has announced the participating organizations for 2021. The list of participating organizations details the 30 organizations participating this year, which includes some projects likely very familiar to our readers, such as LitmusChaos, NumPy, Perl, Julia, and R, among others. The project runs through November of this year and interested technical writers are encouraged to apply ASAP, as organizations must hire writers by mid-May. For further details, check out the technical writer payment process guide, the timeline, and of course, the FAQ.
  • Node.js 16 Arrives with Apple Silicon Support: The latest version of Node.js, Node.js 16, is now available and brings with it additional stable APIs, an update to the V8 JavaScript engine v9.0, and support for the M1 chipset with prebuilt Apple Silicon binaries. Node.js 16 becomes the “current” release of Node.js, scheduled to go into long-term support (LTS) in October of this year, with Node.js 12 remaining LTS until April 2022, Node.js 14 until April 2023, and Node.js going end-of-life this month. Node.js 16 includes a number of features introduced in Node.js 15, such as an experimental implementation of the standard Web Crypto API, but specifically new to this release is the shipping of prebuilt binaries for Apple Silicon, with separate tarballs for the Intel (darwin-x64) and ARM (darwin-arm64) architectures.

Feature image via Pixabay.

A newsletter digest of the week’s most important stories & analyses.