Making Win32 APIs more accessible to more languages

Win32 APIs provide powerful functionality that let you get the most out of Windows in your applications. While these APIs are readily accessible to C and C++ developers, other languages like C# and Rust require wrappers or bindings in order to access these APIs. In C#, this is commonly known as platform invoking or P/Invoke.

Historically this has required developers to handcraft the wrappers or bindings, which is error prone and doesn’t scale to broad API coverage. In recent years, given the strong demand for calling Win32 APIs from various languages, several community projects have spawned to provide more strongly typed and idiomatic representations of these wrappers and bindings to provide an improved developer experience and spare developers the overhead of creating them themselves. Some notable projects include PInvoke for .NET and winapi-rs for Rust.

The main challenge with these projects is they are manually maintained, which makes broad and sustained API coverage difficult and costly, and their work doesn’t really benefit other languages.

As owners of the Windows SDK, we wanted to see where we could provide unique value here, take some of the burden off of the community, and make achieving broad and sustainable API coverage across languages a reality.

The result of this is our win32metadata project and corresponding Win32 language projections now in preview on GitHub!

I’m not a developer, but I think this means that Microsoft is trying to make it easier to tap into the Win32 API with languages other than C and C++. This seems like a smart move considering how popular some of these more modern and/or recent languages have become. It also highlights that despite repeated attempts to kill Win32, Microsoft seems to have accepted that it simply isn’t going anywhere anytime soon.

10 Comments

  1. 2021-01-22 3:25 am
  2. 2021-01-22 11:21 am
    • 2021-01-22 2:36 pm
      • 2021-01-22 5:04 pm
        • 2021-01-22 5:30 pm
    • 2021-01-23 11:41 am
  3. 2021-01-22 2:54 pm
    • 2021-01-22 3:44 pm
      • 2021-01-22 4:34 pm
  4. 2021-01-23 11:40 am