2 ms·
If that is all you need, then Rust has bindgen/cbindgen that does the same. But when your API uses templates/generics and other types that C can't comprehend,
by pornel 8y ago
If that is all you need, then Rust has bindgen/cbindgen that does the same.
But when your API uses templates/generics and other types that C can't comprehend, you need to write additional wrapper functions operating behind opaque C types. It's not rocket science, and tooling/macros can help a lot, but it's still tedious and error prone (you're erasing types, redoing error handling, adding manual memory management, etc.).