cbindgen-0.1.3 is not a library.
Visit the last successful build:
cbindgen-0.28.0
cbindgen
This project can be used to generate C bindings for Rust code. It is currently being developed to support creating bindings for WebRender.
Use
cbindgen crate/ crate/bindings.h
How it works
- All the structs, enums, type aliases, and functions that are representable in C are gathered
- A dependency graph is built using the extern "C" functions as roots
- This removes unneeded types from the bindings and sorts the structs that depend on each other
- Some code generation is done to specialize generics that are specified as type aliases
- The items are printed in dependency order in C syntax
Future work
- More customizable formatting and custom configs
- Extensible system for specifying in source directives
- Better support for types with fully specified names
- Add a validation step
- ...