Use a C++ library with Rust. FFI? wasm?


There is this library written in C++ that I would like to play with using Rust. I have no experience with C++ and I don’t know where to start. My understanding is that at the moment, FFI for C++ are somewhat available, but I don’t have the knowledge necessary to understand whether and to what extent it would be possible to write FFI for this library. My other idea was that maybe it is possible to compile this C++ library to wasm and use it through JS, but here again I can’t tell whether this is a realistic solution. This library has Python and Java bindings, maybe Rust has better FFI capability with those languages? Do any of these seem feasible?


Since there are Java and Python bindings, it seems likely that you’ll be able to write/generate Rust bindings as well.

You can do this with the bindgen crate. I’d start out by running it against the header files mentioned in the .h and .i files in .