finds.dev

Dushistov/flapigen-rs

Tool for connecting programs or libraries written in Rust with other languages

View on GitHub

★ 806RustBSD-3-Clauseupdated Apr 2026

// the take

flapigen-rs generates FFI glue code to expose Rust libraries to C++ and Java/JNI from a declarative `foreign_class!` macro description. It runs at build time via `build.rs`, so the generated files land in your source tree and you never write JNI boilerplate by hand. If you're shipping a Rust core with Android or C++ consumers, this is the tool that makes that manageable.

The `foreign_class!` DSL is genuinely clean — you declare the interface once and the tool handles JNI name mangling, ownership rules, and the Java wrapper classes. The typemap system lets you teach it new type conversions for your own types, which is what separates it from toys that only handle primitives. Test coverage is unusually good for a codegen tool: the `macroslib/tests/expectations/` directory has snapshot files for both the Rust glue and the generated C++/Java, so regressions are caught before they ship. CI is green and the repo saw commits in April 2026, so it's not abandoned.

Python backend (`macroslib/src/python/mod.rs`) exists but is clearly a stub — don't plan a Python binding on this. No async support: if your Rust API uses futures or async traits, you're on your own bridging them across the FFI boundary, which is the common case now. The typemap DSL has a steep learning curve; the documentation covers the happy path but once you need a non-trivial conversion (e.g., returning a `Result<Vec<T>, E>` where T is a foreign class) you'll be reading source code and copying patterns from the test expectations. At 806 stars the community is small, so third-party typemap libraries barely exist and you'll write more yourself than you'd like.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
806
Forks
61
Language
Rust
License
BSD-3-Clause
Last commit
4 Apr 2026

// nearby

If flapigen-rs isn't quite it.

All repos →