Introduction
WeaveFFI generates type-safe bindings for 11 languages for any native library that exposes a C ABI, whether it’s written in Rust, C, C++, Zig, or another language: no hand-written JNI, no duplicate implementations, no unsafe boilerplate.
Define your API once as an IDL in YAML, JSON, or TOML, and WeaveFFI generates idiomatic packages for C, C++, Swift, Kotlin/Android, Node.js, WebAssembly, Python, .NET, Dart, Go, and Ruby, all talking to the same stable C ABI. Any backend that implements the symbols declared in the generated C header can be the producer.
Writing your producer in Rust? Annotate a normal module with
#[weaveffi::module] and the macro generates the C ABI and derives the IDL for
you, so you write no unsafe glue and keep no separate IDL in sync. The macro
is one ergonomic path onto the same engine the IDL uses, so whichever you pick,
the producer you build and the bindings you ship cannot drift.
Why WeaveFFI?
- One definition, eleven languages. Write the API once (safe Rust or an IDL) and ship packages to npm, SwiftPM, Maven, PyPI, NuGet, pub.dev, RubyGems, and Go modules.
- Safe Rust in, C ABI out. The
#[weaveffi::module]macro emits theextern "C"thunks, marshalling every argument through an audited runtime, so a Rust producer writes nounsafeglue and the IDL is derived from the code rather than maintained beside it. - Stable C ABI underneath. Every target speaks to the same
extern "C"contract, so adding a new platform later is a code-gen change, not a rewrite. - Idiomatic per-target output. No lowest-common-denominator surface
area. Swift gets
async/awaitandthrows, Kotlin getssuspendand JNI glue, Python gets typed.pyistubs, TypeScript getsPromises, Dart getsdart:ffi, all from the same definition.
Design principle: standalone generated packages
Generated packages are fully self-contained and publishable to their native ecosystem (npm, CocoaPods, Maven Central, PyPI, NuGet, pub.dev, RubyGems, etc.) without requiring consumers to install WeaveFFI tooling or runtime dependencies. WeaveFFI is a build-time tool for library authors; consumers should never need to know it exists. Helper code (error types, memory management utilities) is generated inline into each package rather than pulled from a shared runtime dependency.
Where to next
- Getting Started: install, define an IDL, generate, and call from C.
- The Rust Producer Macro: the
#[weaveffi::module]attribute family, the supported feature set, and the roadmap. - Comparison: feature matrix vs UniFFI, cbindgen, diplomat, SWIG, autocxx, and an honest “when to choose WeaveFFI” guide.
- FAQ: runtime cost, customization, Windows support, distribution, licensing.
- Samples: the kitchen-sink
kvstorereference plus calculator/contacts/inventory walkthroughs. - Generators: per-target reference for each of the eleven languages.
- Guides: memory ownership, error handling, async, configuration.