cxx
autocxx
Our great sponsors
cxx | autocxx | |
---|---|---|
97 | 17 | |
5,419 | 2,037 | |
- | 2.0% | |
9.3 | 7.7 | |
11 days ago | 26 days ago | |
Rust | Rust | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
cxx
-
Rust is having a positive effect in C/C++
There are cxx and autocxx, what else do you propose to do?
-
Interoperability: Swift’s Super Power
I would like to see a comparison of how this compares to Rust. In terms of interoperability it has Cxx (https://cxx.rs) to offer safe bindings to C++ but also has great support for Android, Linux and many other systems. You don't even need to hack together Windows bindings (as explained in the blog post) because Microsoft offers official bindings (https://crates.io/crates/windows). I'm not sure if I'd call it a superpower if any potential interoperability has to be written to be used (compared to it already being available). Or rather, in comparison to what is interoperability a Swift superpower? Certainly not C++ or C which can be used in a far wider set of targets.
-
Rust Cryptography Should Be Written in Rust
We selected Qt as a cross-platform solution. The C++/Rust interface is the clunkiest and ugliest part of the application, and rather complex because some state is shared between several windows in the GUI and several threads in the backend, and any component might modify that state at any time, and updates have to be transmitted to the other components without introducing inconsistencies. Using cxx [1] helped a little, though.
The project began in 2020, and I'm not sure what I'd choose as a GUI framework today – definitely not Qt Widgets, though.
[1] https://cxx.rs/
-
Link a C static library to rust cargo project
If the build process for the C library isn't too involved I recommend using cxx bridge (https://cxx.rs/) and letting cargo handle the build and linking. cxx basically allows you to describe the bidirectional interface (although it sounds like you only need 1 direction, which is fine too) in Rust code and it provides a "good enough" API for compiling C code inside the build.rs file.
-
ffizz: Build a Beautiful C API in Rust
The tooling for the first kind -- calling Rust from another language -- is a bit less developed, and tends to rely on code generation that doesn't necessarily produce a natural C API. cbindgen, uniffi, cxx, and Diplomat all take this course.
-
Best practices in creating a Rust API for a C++ library? Seeking advice from those who've done it before.
I would like to utilize OMPL's functionality in Rust code, so I want to call into OMPL C++ code somehow in Rust. I've seen two (non-mutually-exclusive) options so far: - rust-cpp, which allows you to write C++ code in Rust within the cpp!() macro. - cxx, which allows you to define both sides of the FFI boundary manually (as opposed to bindgen's automatic generation).
-
Hey Rustaceans! Got a question? Ask here (20/2023)!
I'm not sure how to do this in cxx; issues like https://github.com/dtolnay/cxx/issues/447 suggest that this isn't settled yet?
-
Hello r/Rust! We are Meta Engineers who created the Open Source Buck2 Build System! Ask us anything! [Mod approved]
I use non-vendored dependencies for the Buck build in https://github.com/dtolnay/cxx.
-
Microsoft is rewriting core Windows libraries in Rust
There's also the cpp and cxx crates for doing C++/Rust interop, but they probably aren't appropriate to use in all cases. The C ABI is definitely the safest way to go unless you're really trying to marry Rust and C++ code bases, not just writing library bindings.
-
How can I use rust libraries in C++
There's also cxx (can't vouch for it personally but it claims to make things a lot easier) https://github.com/dtolnay/cxx
autocxx
-
How do you feel about comments made by Tim Sweeney?
Meanwhile, one of the best C++ sources which community mostly think of - Chromium - starting to experience with Rust. If i'm not mistaken using https://github.com/google/autocxx
-
The Val Object Model : Dave Abrahams, Sean Parent, Dimitri Racordon, David Sankel
There's bindgen, cxx and autocxx. Obviously not as convenient as C++ calling C++; the more you need to interoperate with C++ code the more it makes sense to just stay with C++.
-
Are we reference yet? C++ references in Rust
If you want to reach the author for a correction, perhaps leave a comment on the Medium post or perhaps mention it on the autocxx PR I found this article from.
-
The Unicode Consortium announces ICU4X 1.0, its new high-performance internationalization library. It's written in Rust, with official C++ and JavaScript wrappers available.
Rust and C++ are not directly interoperable, but you can try to use some fancy libraries if your C++ codebase is simple. Google is taking on this gargantuan task with autocxx. I believe it is related to their exploration efforts to bring Rust to Chrome.
-
Mark Russinovich (Azure CTO): "it's time to halt starting any new projects in C/C++ and use Rust"
I used autocxx in a recent project and was amazed at how easy it was to call into C++ -- Rust Analyzer was even able to provide completion hints.
-
The State Of Rust In 2022 – De Programmatica Ipsum
Sure, they can improve C++ interop - and they have been - but that doesn't help them maintain the dozens of millions of lines of C++ they (Google, and others) currently have. Carbon is a pragmatic solution to the state of affairs in C++ that doesn't require them to rewrite all of their existing code to improve its maintainability.
-
Programming languages endorsed for server-side use at Meta
The areas you mentioned (CLI, web services, low level systems programming) are not mutually exclusive. Doing a good job on one doesn't mean something else is affected.
The folks who worked on the most popular command line argument parser (https://docs.rs/clap/latest/clap/#example) made a positive contribution that didn't detract from any other use case.
Similarly, the folks working on improving Rust for web services will also make it better for systems programming. In a blog post published today (https://blog.rust-lang.org/inside-rust/2022/07/27/keyword-ge...), they discuss keyword generics, a feature that will be equally helpful for `async` code and `const` functions evaluated at compile time.
There is already some interoperability with C++ (http://cxx.rs) and ongoing research into automating this interoperability (https://github.com/google/autocxx, https://github.com/google/crubit). Feels like there's enough effort
-
Google brands Carbon language as an 'experimental successor to C++'
That's not at all in Rust's bill, it needs an interaction layer to talk to C++. Efforts like cxx (and google's own autocxx) try to make this layer more automated and less painful, but the layer is still there, it still has a cost, and it doesn't erase the impedance mismatches between the languages.
-
Carbon Language: An experimental successor to C++
Notably Google is also investing in autocxx to make C++/Rust bidirectional interoperation easier
-
Carbon - an experimental C++ successor language
Again, not really...? A lot of the proposed ABI changes (for C++ - I don't know what they're planning for Carbon) are trivial to automatically fix if you have source access. If you don't have source access, you "only" need to maintain the ABI at the boundaries between foreign code and your code, which is quite possible (especially after the success of autocxx and related projects in the Rust <-> C++ world)
What are some alternatives?
cbindgen - A project for generating C bindings from Rust code
rust-bindgen - Automatically generates Rust FFI bindings to C (and some C++) libraries.
TIC-80 - TIC-80 is a fantasy computer for making, playing and sharing tiny games.
uniffi-rs - a multi-language bindings generator for rust
gdnative - Rust bindings for Godot 3
rust-cpp - Embed C++ directly inside your rust code!
carbon-lang - Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
ritual - Use C++ libraries from Rust
jakt - The Jakt Programming Language
libfive - Infrastructure for solid modeling
sonyflake-rs - 🃏 A distributed unique ID generator inspired by Twitter's Snowflake.