Demonstrates generating Dart FFI bindings from a Zig source file that uses @cImport
with nested headers, structs, unions, enums, callbacks, arrays, and opaque-like
pointer patterns.
See the C imports guide for header discovery, libc, cross-compilation, and limitations.
From the example/cimport directory:
dart run native_toolchain_zig:zig bindings \
--zig-dir zig \
--root-source-file src/lib.zig \
--output lib/ffi.g.dartdart run cimport:main@cImportof multiple local headers.- Struct, union, enum, and function pointer translation.
- Arrays, nested records, pointer chains, and callback plumbing.
- Generated Dart bindings plus a small wrapper around the raw FFI surface.