{"id":13437819,"url":"https://github.com/mozilla/cbindgen","last_synced_at":"2026-04-02T20:47:24.823Z","repository":{"id":39033870,"uuid":"88066646","full_name":"mozilla/cbindgen","owner":"mozilla","description":"A project for generating C bindings from Rust code","archived":false,"fork":false,"pushed_at":"2026-04-01T00:51:53.000Z","size":2902,"stargazers_count":2862,"open_issues_count":267,"forks_count":372,"subscribers_count":35,"default_branch":"main","last_synced_at":"2026-04-01T02:51:43.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mozilla.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-04-12T15:18:41.000Z","updated_at":"2026-04-01T00:54:39.000Z","dependencies_parsed_at":"2023-02-16T17:01:09.379Z","dependency_job_id":"e47734c4-b382-48d3-aa54-0f2e6cfad716","html_url":"https://github.com/mozilla/cbindgen","commit_stats":{"total_commits":1115,"total_committers":147,"mean_commits":7.585034013605442,"dds":0.6914798206278027,"last_synced_commit":"89a9faa97cc267e90fc95a1cc6177a001aed5b51"},"previous_names":["eqrion/cbindgen"],"tags_count":111,"template":false,"template_full_name":null,"purl":"pkg:github/mozilla/cbindgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fcbindgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fcbindgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fcbindgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fcbindgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mozilla","download_url":"https://codeload.github.com/mozilla/cbindgen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fcbindgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31316007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-07-31T03:01:00.452Z","updated_at":"2026-04-02T20:47:24.781Z","avatar_url":"https://github.com/mozilla.png","language":"Rust","readme":"# `cbindgen` \u0026emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![Api Rustdoc]][rustdoc] [![Rust](https://img.shields.io/badge/rust-1.70%2B-blue.svg?maxAge=3600)](https://github.com/mozilla/cbindgen)\n\n[Build Status]: https://github.com/mozilla/cbindgen/workflows/cbindgen/badge.svg\n[actions]: https://github.com/mozilla/cbindgen/actions\n[Latest Version]: https://img.shields.io/crates/v/cbindgen.svg\n[crates.io]: https://crates.io/crates/cbindgen\n[Api Rustdoc]: https://img.shields.io/badge/api-rustdoc-blue.svg\n[rustdoc]: https://docs.rs/cbindgen\n\n[Read the full user docs here!](https://github.com/mozilla/cbindgen/blob/main/docs.md)\n\ncbindgen creates C/C++11 headers for Rust libraries which expose a public C API.\n\nWhile you could do this by hand, it's not a particularly good use of your time.\nIt's also much more likely to be error-prone than machine-generated headers that\nare based on your actual Rust code. The cbindgen developers have also worked\nclosely with the developers of Rust to ensure that the headers we generate\nreflect actual guarantees about Rust's type layout and ABI.\n\nC++ headers are nice because we can use operator overloads, constructors, enum\nclasses, and templates to make the API more ergonomic and Rust-like. C headers\nare nice because you can be more confident that whoever you're interoperating\nwith can handle them. With cbindgen *you don't need to choose*! You can just\ntell it to emit both from the same Rust library.\n\nThere are two ways to use cbindgen: as a standalone program, or as a library\n(presumably in your build.rs). There isn't really much practical difference,\nbecause cbindgen is a simple rust library with no interesting dependencies.\n\nUsing it as a program means people building your software will need it\ninstalled. Using it in your library means people may have to build cbindgen more\nfrequently (e.g. every time they update their rust compiler).\n\nIt's worth noting that the development of cbindgen has been largely adhoc, as\nfeatures have been added to support the usecases of the maintainers. This means\ncbindgen may randomly fail to support some particular situation simply because\nno one has put in the effort to handle it yet. [Please file an issue if you run\ninto such a situation](https://github.com/mozilla/cbindgen/issues/new). Although\nsince we all have other jobs, you might need to do the implementation work too\n:)\n\n# Quick Start\n\nTo install cbindgen, you just need to run\n\n```text\ncargo install --force cbindgen\n```\n\n(--force just makes it update to the latest cbindgen if it's already installed)\n\nOr with Homebrew, run\n\n```text\nbrew install cbindgen\n```\n\nTo use cbindgen you need two things:\n\n* A configuration (cbindgen.toml, which can be empty to start)\n* A Rust crate with a public C API\n\nThen all you need to do is run it:\n\n```text\ncbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h\n```\n\nThis produces a header file for C++.  For C, add the `--lang c` switch.\n\nSee `cbindgen --help` for more options.\n\n[Read the full user docs here!](docs.md)\n\n[Get a template cbindgen.toml here.](template.toml)\n\n# Examples\n\nWe don't currently have a nice tailored example application, but [the\ntests](tests/rust/) contain plenty of interesting examples of our features.\n\nYou may also find it interesting to browse the projects that are using cbindgen\nin production:\n\n* [milksnake](https://github.com/getsentry/milksnake)\n* [webrender](https://searchfox.org/mozilla-central/source/gfx/webrender_bindings) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/gfx/webrender_bindings/webrender_ffi_generated.h))\n* [stylo](https://searchfox.org/mozilla-central/source/layout/style) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/layout/style/ServoStyleConsts.h))\n* [maturin](https://github.com/PyO3/maturin)\n* [tquic](https://github.com/Tencent/tquic) ([generated header](https://github.com/Tencent/tquic/blob/develop/include/tquic.h))\n* [metatensor](https://github.com/metatensor/metatensor) ([generated header](https://github.com/metatensor/metatensor/blob/main/metatensor-core/include/metatensor.h))\n\nIf you're using `cbindgen` and would like to be added to this list, please open\na pull request!\n\n# Releases\n\ncbindgen doesn't have a fixed release calendar, please file an issue requesting\na release if there's something fixed in trunk that you need released. Ping\n`@emilio` for increased effect.\n","funding_links":[],"categories":["Development tools","Rust","Awesome Tools"],"sub_categories":["FFI","Languages"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla%2Fcbindgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozilla%2Fcbindgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla%2Fcbindgen/lists"}