Hacker News new | ask | show | jobs
by tormeh 267 days ago
You can use C++ libraries from Rust. That's a very normal thing to do. People start new projects in C++ either because they themselves don't want to learn a new thing or because they don't want their employees spending time learning a new thing.
2 comments

Appart from cxx.rs. I think most binding between C++ and Rust are in fact C and Rust binding. So you need a C API to your C++ library (no template, no std etc...). So for me you can't use C++ library from Rust.
You can just use CXX? Idk what to tell you. A coworker of mine is doing it. It's not some kind of weird thing.
cxx only support a part of c++ STL container. It doesn't support template and custom container implementation. So no generic, no variadic number of argument, no automatic type déduction etc...
> You can use C++ libraries from Rust.

I doubt it. You can use C libraries from Rust, and emit C libraries in C++.

> because they themselves don't want to learn a new thing or because they don't want their employees spending time learning a new thing.

Whining about others not wanting to learn when you could have learned how Rust FFI works is, really, hilarious :-)

A coworker of mine is using CXX in a combined Rust and C++ code base. This is not exotic.