I'm working on a Rust library that I would like to make accessible from other languages -- C/C++ but more importantly scripting languages like Python and Ruby (and probably Java too). I'd like to make this process as easy as possible -- ideally, easy enough that I don't have to maintain the language bindings!
I can build a C++ API for the crate using cxx -- thanks for that! What I'm unsure of is how to make that generally useful so that someone else writing, say, a Perl binding in another repo could easily interface with my crate via that C++ API. Cxx seems geared toward use wtihin a single project that contains both Rust and C++. I would like to cross a project boundary at the same time.
Options I can think of:
Provide instructions for copying the bridge into their project, basically giving them a pre-baked cxx bridge without requiring a lot of Rust knowledge.
Build the C++ API into a dylib + header file and package that. But I think that such a dylib is specific to the compiler / version used to create it?
Wrap the C++ API in a C API and package that into a dylib + header.
Any advice or, better, examples of crates that do this sort of thing would be appreciated!
I'm working on a Rust library that I would like to make accessible from other languages -- C/C++ but more importantly scripting languages like Python and Ruby (and probably Java too). I'd like to make this process as easy as possible -- ideally, easy enough that I don't have to maintain the language bindings!
I can build a C++ API for the crate using cxx -- thanks for that! What I'm unsure of is how to make that generally useful so that someone else writing, say, a Perl binding in another repo could easily interface with my crate via that C++ API. Cxx seems geared toward use wtihin a single project that contains both Rust and C++. I would like to cross a project boundary at the same time.
Options I can think of:
Any advice or, better, examples of crates that do this sort of thing would be appreciated!