dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.68k stars 320 forks source link

Guide for publishing a crate with its bridge #1314

Open djmitche opened 4 months ago

djmitche commented 4 months ago

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!