What's the best way to call C++ Code?

Hi everyone,

I'm a beginner in Rust and I really like it so far. But it's still a young language and therefore lacks some libraries. Thats why I'm interested in how to use a C++ library from Rust. So far I found the crates cxx, bindgen and cbindgen. cxx seems to take a different approach than the other two. At first sight it still seems to be the best choice but I'm not sure about that.

What is your experience with calling C++ from Rust and which crate can you recommend? Especially: how good does it work in bigger and more complicated projects?

Thanks in advance :slight_smile:

I think "Ritual (https://rust-qt.github.io/)" is probably your best bet.

3 Likes

Thank you I will have a look at it :slight_smile:

I've had good results with rust-cpp.

1 Like

There's also https://github.com/dtolnay/cxx, which provides a safe Rust interface.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.