{"id":13418161,"url":"https://github.com/rust-lang/rust-bindgen","last_synced_at":"2025-12-12T15:32:45.151Z","repository":{"id":38331451,"uuid":"61728459","full_name":"rust-lang/rust-bindgen","owner":"rust-lang","description":"Automatically generates Rust FFI bindings to C (and some C++) libraries.","archived":false,"fork":false,"pushed_at":"2025-04-10T00:10:56.000Z","size":19075,"stargazers_count":4771,"open_issues_count":527,"forks_count":742,"subscribers_count":57,"default_branch":"main","last_synced_at":"2025-05-05T20:21:59.575Z","etag":null,"topics":["bindings","codegen","ffi"],"latest_commit_sha":null,"homepage":"https://rust-lang.github.io/rust-bindgen/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-06-22T15:05:51.000Z","updated_at":"2025-05-05T13:02:43.000Z","dependencies_parsed_at":"2022-07-09T11:00:21.978Z","dependency_job_id":"e8642311-64d2-424b-ba68-2e4b4857d0e0","html_url":"https://github.com/rust-lang/rust-bindgen","commit_stats":{"total_commits":2798,"total_committers":417,"mean_commits":6.709832134292566,"dds":0.8148677626876341,"last_synced_commit":"8a6d851318153b7304b651a7fd8f559938683de3"},"previous_names":["servo/rust-bindgen","rust-lang-nursery/rust-bindgen"],"tags_count":125,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frust-bindgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frust-bindgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frust-bindgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frust-bindgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-lang","download_url":"https://codeload.github.com/rust-lang/rust-bindgen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253700538,"owners_count":21949692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","codegen","ffi"],"created_at":"2024-07-30T22:00:59.138Z","updated_at":"2025-12-12T15:32:45.102Z","avatar_url":"https://github.com/rust-lang.png","language":"Rust","readme":"[![crates.io](https://img.shields.io/crates/v/bindgen.svg)](https://crates.io/crates/bindgen)\n[![docs.rs](https://docs.rs/bindgen/badge.svg)](https://docs.rs/bindgen/)\n\n# `bindgen`\n\n**`bindgen` automatically generates Rust FFI bindings to C (and some C++) libraries.**\n\nFor example, given the C header `doggo.h`:\n\n```c\ntypedef struct Doggo {\n    int many;\n    char wow;\n} Doggo;\n\nvoid eleven_out_of_ten_majestic_af(Doggo* pupper);\n```\n\n`bindgen` produces Rust FFI code allowing you to call into the `doggo` library's\nfunctions and use its types:\n\n```rust\n/* automatically generated by rust-bindgen 0.99.9 */\n\n#[repr(C)]\npub struct Doggo {\n    pub many: ::std::os::raw::c_int,\n    pub wow: ::std::os::raw::c_char,\n}\n\nextern \"C\" {\n    pub fn eleven_out_of_ten_majestic_af(pupper: *mut Doggo);\n}\n```\n\n## Users Guide\n\n[📚 Read the `bindgen` users guide here! 📚](https://rust-lang.github.io/rust-bindgen)\n\n## MSRV\n\nThe `bindgen` minimum supported Rust version is **1.70.0**.\n\nThe `bindgen-cli` minimum supported Rust version is **1.70.0**.\n\nNo MSRV bump policy has been established yet, so MSRV may increase in any release.\n\nThe MSRV is the minimum Rust version that can be used to *compile* each crate. However, `bindgen` and `bindgen-cli` can generate bindings that are compatible with Rust versions below the current MSRV.\n\nMost of the time, the `bindgen-cli` crate will have a more recent MSRV than `bindgen` as crates such as `clap` require it. \n\n## API Reference\n\n[API reference documentation is on docs.rs](https://docs.rs/bindgen)\n\n## Environment Variables\n\nIn addition to the [library API](https://docs.rs/bindgen) and [executable command-line API][bindgen-cmdline],\n`bindgen` can be controlled through environment variables.\n\nEnd-users should set these environment variables to modify `bindgen`'s behavior without modifying the source code of direct consumers of `bindgen`.\n\n- `BINDGEN_EXTRA_CLANG_ARGS`: extra arguments to pass to `clang`\n    - Arguments are whitespace-separated\n    - Use shell-style quoting to pass through whitespace\n    - Examples:\n        - Specify alternate sysroot: `--sysroot=/path/to/sysroot`\n        - Add include search path with spaces: `-I\"/path/with spaces\"`\n- `BINDGEN_EXTRA_CLANG_ARGS_\u003cTARGET\u003e`: similar to `BINDGEN_EXTRA_CLANG_ARGS`,\n   but used to set per-target arguments to pass to clang. Useful to set system include\n   directories in a target-specific way in cross-compilation environments with multiple targets.\n   Has precedence over `BINDGEN_EXTRA_CLANG_ARGS`.\n\nAdditionally, `bindgen` uses `libclang` to parse C and C++ header files.\nTo modify how `bindgen` searches for `libclang`, see the [`clang-sys` documentation][clang-sys-env].\nFor more details on how `bindgen` uses `libclang`, see the [`bindgen` users guide][bindgen-book-clang].\n\n## Releases\n\nWe don't follow a specific release calendar, but if you need a release please\nfile an issue requesting that (ping `@emilio` for increased effectiveness).\n\n## Contributing\n\n[See `CONTRIBUTING.md` for hacking on `bindgen`!](./CONTRIBUTING.md)\n\n[bindgen-cmdline]: https://rust-lang.github.io/rust-bindgen/command-line-usage.html\n[clang-sys-env]: https://github.com/KyleMayes/clang-sys#environment-variables\n[bindgen-book-clang]: https://rust-lang.github.io/rust-bindgen/requirements.html#clang\n","funding_links":[],"categories":["TODO scan for Android support in followings","Development tools","Rust","开发工具 Development tools","C++","开发工具","FFI Bindings","3. Safe FFI and Interoperability"],"sub_categories":["FFI","FFI FFI","示例 FFI","3.3 Bindgen"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Frust-bindgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-lang%2Frust-bindgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Frust-bindgen/lists"}