I of course, think that C FFI is as good as I personally need it to be. It's as good or better than most other languages that are not C.
I think at least for non-mutable stuff, C++ string_view (approximately rust &str), span (approximately rust slices), and the like should make at least some operations as simple as pointer casts, but having tooling to automate the boilerplate would be nice, and they're also new/not that widely supported (std::span is from C++ 20). And mutable stuff, if you want to be able to write idiomatic/ergonomic code on both sides, seems like a much bigger lift.
Compare that to C, where the story is often as good as "import the header and you're done".
I'm not sure if there's a good path to a long-term solution, but I've been pushing to get nice C APIs in all the libraries I'm invested in, specifically because of this issue.
So while .NET type type doesn't cover all of C++, it does cover enough not to have clunky C interfaces, and nowadays many Windows APIs only have such COM/UWP interfaces as public API.
Microsoft is in the process of adding Rust to their COM/WinRT infrastructure.
One of the beauties of COM is that it is interface based component model, so it goes quite well with languages that have interfaces/traits as feature.
[0] I really don't care if in C or a different language, but I'm not aware of relevant programming subcultures where that simplicity of interfacing is such an important pillar to their culture and their success.
Yes, C is clunky and primitive, it was my opinion in 1992 coming from Turbo Pascal 6, and it hasn't changed since.
Seriously, here is just one taste of the intricacies of the COM: https://www.codeproject.com/Articles/9190/Understanding-The-...
This is 90's enterprise OOP technology. There is no good excuse to use this other than technical debt.
There is no good excuse to use outdated articles to attack technology one hates.
Here, some 2020 stuff to educate yourself.
https://docs.microsoft.com/en-us/windows/uwp/get-started/cre...
When I attack C's clunky and archaic coding, I do so with full knowledge of C17 and how little it has changed with K&R C that I learned in 1992, in API design and OS security.
https://github.com/rytc/enet_single/blob/master/enet_single....
WinRT is no mess, and I look forward to the day everyone has to put up with them, now that both application models are being merged anyway.
SWIG is what people really want.
IMHO going through C APIs is fine, because C++ interoperability is much harder and a moving target, just because the language surface is so much bigger than plain C.
See Zig as an example for excellent C interoperability.
As soon as a C/C++ compiler toolchain and build tools need to be involved in a Rust project you're basically loosing all advantages of Cargo and are back to the relative brittleness of cross-platform C/C++ builds.
(I was only thinking of calling)