capnproto-rust
capnproto-rust copied to clipboard
Export APIs as C with the help of bindgen
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.
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.
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.