winrt-rust icon indicating copy to clipboard operation
winrt-rust copied to clipboard

[Question] Plans to use the new cppwinrt project?

Open pingzing opened this issue 8 years ago • 6 comments

Looks like Microsoft just released a new repo that contains Vanilla C++ projections for WinRT: https://github.com/Microsoft/cppwinrt (and the associated blog post)

Would using this be easier than generating the necessary metadata from the DLLs themselves? Mostly asking as a curious party.

pingzing avatar Dec 05 '16 16:12 pingzing

If by "using this" you mean "wrapping these C++ headers" from Rust (or generating the Rust wrappers from C++ headers instead of from the winmd files), that's probably not easier, because interfacing with C++ from Rust is not (yet) as easy as interfacing with C. Furthermore, they use co_await for asynchronous calls, which I think is only available in Microsoft's C++ compiler at the moment.

However, this also looks like it's also autogenerated (who would write code like this by hand?) and we might be able to get some inspiration how they solved certain things (especially since they say it's more efficient than using C# or C++/CX). Maybe they will even open-source the tools to generate these headers at some point. By the way, C(++) headers for WinRT (without C++/CX) already existed previously (available via the Windows SDK), and winrt-rust has already drawn some inspiration from there.

Anyway, thanks for pointing this new project out to us!

Boddlnagg avatar Dec 05 '16 17:12 Boddlnagg

Ah, I wasn't aware that C++-from-Rust was notably trickier than C-from-Rust (though I guess I should have been). Anyway, thanks for satisfying my curiosity, and happy to at least give you a source of inspiration!

pingzing avatar Dec 07 '16 11:12 pingzing

I have now looked at this again, and especially the information on https://moderncpp.com/ and https://kennykerr.ca/ (the author's blog) is very helpful and inspiring indeed!

Boddlnagg avatar Feb 26 '17 00:02 Boddlnagg

There are also some talks from CppCon 2016 about this: https://www.youtube.com/watch?v=lm4IwfiJ3EU and https://www.youtube.com/watch?v=v0SjumbIips

Boddlnagg avatar Feb 27 '17 11:02 Boddlnagg

Another interesting video from CppCon 2017: https://www.youtube.com/watch?v=7TdpWB_vRZM

Boddlnagg avatar Dec 08 '17 22:12 Boddlnagg

Now C++/WinRT compiler is open source with a project called xlang. https://kennykerr.ca/2019/01/25/getting-started-with-xlang-and-cppwinrt/ https://github.com/Microsoft/xlang

ZHOUYue67 avatar Mar 13 '19 14:03 ZHOUYue67