[−][src]Crate dart_bindgen
Dart Bindgen
Generate Dart FFI bindings to C Header file.
Supported C Language Features
- Functions
- Function Pointer (aka
callback
) - Simple structs (NOTE: Nested structs is not supported yet, open a PR?)
Example
in your build.rs
:
ⓘThis example is not tested
let config = DynamicLibraryConfig { ios: DynamicLibraryCreationMode::Executable.into(), android: DynamicLibraryCreationMode::open("libsimple.so").into(), ..Default::default() }; // load the c header file, with config and lib name let codegen = Codegen::builder() .with_src_header("simple-ffi/include/simple.h") .with_lib_name("libsimple") .with_config(config) .build()?; // generate the dart code and get the bindings back let bindings = codegen.generate()?; // write the bindings to your dart package // and start using it to write your own high level abstraction. bindings.write_to_file("simple/lib/ffi.dart")?;
Modules
config | Bindgens config for loading |
Structs
Bindings | A bindings using |
Codegen | Dart Code Generator |
CodegenBuilder | The |