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

Export APIs as C with the help of bindgen #394

Open
XVilka opened this issue Apr 23, 2023 · 2 comments
Open

Export APIs as C with the help of bindgen #394

XVilka opened this issue Apr 23, 2023 · 2 comments

Comments

@XVilka
Copy link

XVilka commented Apr 23, 2023

Since pure C version of the capnproto is dead, it would be nice also to have an option to use the Rust implementation as the C library.

@dwrensha
Copy link
Member

As far as I know, bindgen does not work in that direction. You give it a C library, and it gives you a Rust interface to it. Here, what you would want is to get a C interface from a Rust library.

Figuring out a decent API to expose to C would require a lot of work. (Some tricky questions are: how to deal with generics? and how to do error handling?) My initial sense is that such work would be better spent on maintaining the existing C implementation or making a new one from scratch.

@JPSGoncalves
Copy link

JPSGoncalves commented May 8, 2023

There is another project that execute the reverse of bindgen, cbindgen (https://github.com/mozilla/cbindgen). I don't know if it worth it, but maybe it is possible to use bindings for C using the capnproto Rust implementation.

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

3 participants