finds.dev← search

// the find

Dushistov/flapigen-rs

★ 806 · Rust · BSD-3-Clause · updated Apr 2026

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

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.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →