COM and WinRT support efforts?



since Windows XP, most newly introduced Win32 API are actually COM based, with WinRT picking the design where COM+ 2.0 gave birth to .NET.

Are there any ongoing efforts to make Rust play nice with COM and eventually WinRT?

I am think of macros and libraries that would allow Rust traits to be exposed as COM, similarly expose COM interfaces as traits to Rust code. Based on how Delphi, C++ Builder, .NET and the various MSVC++ extensions deal with COM and now WinRT.



We already have access to quite a few Windows APIs through There’s still a lot of crates under this umbrella that are only stubs, but many of the important ones like user32-sys and kernel32-sys are fully functional.

If you want to get involved, hit up WindowsBunny (@retep998) on the #winapi channel on the Moznet IRC.


By using the interfaces defined in winapi with ComPtr from wio you can actually get some fairly nice code for working with COM. Really the difficult part is just porting the COM interfaces to Rust by hand because bindgen is incapable of doing so, which is why I don’t have all the COM interfaces defined yet, nevermind all the WinRT interfaces.

Note that implementing a COM interface yourself in Rust is something that really just hasn’t been done yet and is silly complicated.


@retep998 Thanks for the description.

So it means that using COM from Rust is still like old style C++.

No plans in sight to make it as friendly as other Windows main languages like I mentioned?

I got spoiled using Windows tooling for COM, so going the old way of doing everything by hand is not so appealing.

My use case would be to use Rust in the context of WinRT applications, instead of having to create a .NET or C++/CX wrapper.

I guess I need to explore the links you sent.