Hacker News new | past | comments | ask | show | jobs | submit login

Not a working group, but a library does exist: https://cxx.rs/



The difference is that cxx is doing codegen to create a C ABI compatible bridge. So the same thing most people already do when they want to interact w/ C++ over FFI.

I believe that TFA is actually saying that the Swift compiler speaks C++ directly without doing any codegen and just handles everything at the compilation level. Same end result but a lot of subtle differences. Not having to do codegen is a big win, especially in Rust where compile times aren't terrific and binary sizes can already bloat up due to the statically linked nature.


Yes, cxx.rs is really good for what it is! There's also autocxx that aims at generating cxx bridges directly. What Rust lacks is, to my knowledge, a C++ interoperability working group. cxx.rs (which is useable but by no means finished) could be a topic of such a working group. Direct compiler support of C++ could be another.

A better C++ rust interop story is a critical piece for Rust's success IMO


I hope one does not need to write the signatures manually and tweak the cxx generator, for detecting flags, types and the like just to get it properly working. If that's the case, then that would be tons of maintenance and more trouble than its worth for a more complex C++ codebase.

Best to make that a first party feature built into the language compiler and have it do the majority of the work automatically rather than manually define the C++ types, functions, etc using a third party library.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: