# bindgen

> Generates Rust FFI bindings to C and some C++ libraries from their headers

Source: https://talira.ai/catalog/bindgen-8awz7b66
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [developer tools / language bindings](https://talira.ai/categories/developer-tools/language-bindings), [languages / rust](https://talira.ai/categories/languages/rust)
- Licence: BSD-3-Clause[^4]
- Pricing: Free and open source[^4]
- Free tier: yes[^4]
- Backed by: [The Rust Project](https://talira.ai/orgs/rust-project.md)

bindgen reads C (and some C++) header files with libclang and generates the Rust FFI code to call into the library and use its types: repr(C) structs, extern function declarations, enums and constants. Most projects run it from a build.rs script as a build dependency, so bindings are generated at compile time; the bindgen-cli crate does the same from the command line. Options control which items are allowlisted or blocklisted, which types stay opaque or are replaced, and which traits are derived, and environment variables pass extra arguments to clang, per target for cross-compilation. It's maintained under the Rust project's GitHub organization.

## Links

- Website: https://rust-lang.github.io/rust-bindgen/
- GitHub: https://github.com/rust-lang/rust-bindgen
- Docs: https://docs.rs/bindgen

## Ways to install

### Package managers

- [Homebrew](https://talira.ai/catalog/homebrew-djy17yn9.md): <https://formulae.brew.sh/formula/bindgen>[^1]

## Problems it solves

- call a C library from Rust without writing the bindings by hand
- generate Rust types from a C header file at build time
- wrap a system library like libgit2 or SQLite in a Rust crate

## Features

- Generates repr(C) structs, extern functions, enums and constants from C headers
- Runs from build.rs as a build dependency, or from the command line with bindgen-cli
- Allowlisting, blocklisting, opaque and replaced types
- Control over derived traits such as Copy and Clone
- Extra clang arguments through environment variables, per target for cross-compiling

## Limitations

- C++ support is partial: it handles C and only some C++[^2]
- Needs libclang installed to parse headers[^3]

## Trust

Overall: 0.68 out of 1.
Signals: maintenance 0.97, adoption 0.75, momentum 0.49, community 1.00, backing 0.30, extensibility 0.00.

- last commit 6 days ago
- 55 commits in the last 90 days
- latest release v0.73.2 55 days ago
- 5.3k GitHub stars
- 467 contributors
- 57 Homebrew installs in 30 days
- backed by The Rust Project

## Alternatives

- [flutter_rust_bridge](https://talira.ai/catalog/flutter-rust-bridge-5cp1d45d.md): Call Rust code from Flutter and Dart, with the glue code generated for you
- [napi-rs](https://talira.ai/catalog/napi-rs-ka76jrjv.md): A framework for building compiled Node.js add-ons in Rust via Node-API
- [GObject Introspection](https://talira.ai/catalog/gobject-introspection-nz3pkj44.md): Middleware between GObject-based C libraries and language bindings
- [wasm-bindgen](https://talira.ai/catalog/wasm-bindgen-r2y6dgby.md): Generates the glue between Rust WebAssembly modules and JavaScript

## Sources

[^1]: https://formulae.brew.sh/api/formula.json (checked 28 Nov 2026)
[^2]: https://github.com/rust-lang/rust-bindgen (checked 28 Nov 2026)
[^3]: https://rust-lang.github.io/rust-bindgen/requirements.html (checked 28 Nov 2026)
[^4]: https://github.com/rust-lang/rust-bindgen/blob/main/LICENSE (checked 28 Nov 2026)
