Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide for publishing a crate with its bridge #1314

Open
djmitche opened this issue Feb 12, 2024 · 0 comments
Open

Guide for publishing a crate with its bridge #1314

djmitche opened this issue Feb 12, 2024 · 0 comments

Comments

@djmitche
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant