#bindings #ffi #code-generation #dart

bin+lib dart-bindgen

A tool for generating Dart FFI bindings to C Header file

9 releases

0.1.8 Nov 9, 2020
0.1.7 Aug 14, 2020
0.1.4 Jul 21, 2020
0.1.1 Jun 27, 2020

#61 in FFI

Download history 194/week @ 2020-11-06 277/week @ 2020-11-13 135/week @ 2020-11-20 69/week @ 2020-11-27 79/week @ 2020-12-04 28/week @ 2020-12-11 46/week @ 2020-12-18 5/week @ 2020-12-25 19/week @ 2021-01-01 27/week @ 2021-01-08 392/week @ 2021-01-15 409/week @ 2021-01-22 400/week @ 2021-01-29 104/week @ 2021-02-05 208/week @ 2021-02-12 148/week @ 2021-02-19

420 downloads per month

Custom license

51KB
1K SLoC

Dart Bindgen

A tool for generating Dart FFI bindings to C Header file.

Goals

  1. be able to generate a single ffi.dart file that should contain all the C header bindings.
  2. Current Supported C Features
  • Functions
  • Function Pointer (aka Callbacks)
  • Simple Structs (NOTE: Nested structs is not supported yet, open a PR?)
  • C Enums

Non-Goals

Writing a High-Level Abstractions and idiomatic Dart Code for the FFI bindgens, we will leave that as a homework for the user :).

Install

Make sure you have installed the dependencies:

  1. LLVM and clang

on macOS:

brew install llvm

on Windows:

Download a prebuild from here

on Linux:

you know what to do ;)


and then you could install the CLI from github releases or you could also use cargo to build it from source:

$ cargo install --force dart-bindgen --features cli

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

License

Licensed under Apache v2.0 license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Dependencies

~0.9–1.7MB
~38K SLoC