cheadergen is a tool designed to generate C headers from Rust libraries that provide a C-compatible API. It addresses the need for interoperability between Rust and C by producing headers that allow C code to interface with Rust code written using constructs like extern "C", [no_mangle], and [repr(C)]. This makes it useful for developers who maintain mixed Rust and C projects or who want to expose Rust functionality to C-based systems.
The tool offers several features to streamline the header generation process. It supports multi-crate Rust projects, automatically generating one C header per crate and wiring up cross-crate include directives. cheadergen leverages rustdoc-json to perform compiler-accurate type analysis, ensuring that the generated headers reflect the types as seen by the Rust compiler. It is also macro-aware, automatically detecting items defined by both declarative and procedural macros. The generated output includes the appropriate struct and function definitions for use in C code.
cheadergen is delivered as a command-line interface (CLI) tool. The documentation provides guidance on installing the CLI, using it within Cargo workflows, generating headers across workspaces, and migrating from other tools such as cbindgen. The tool is built and maintained by Luca Palmieri.
The service positions itself as an alternative to cbindgen and includes a comparison to help users evaluate its suitability. The documentation also covers configuration options available through attributes and configuration files. cheadergen is aimed at developers who are familiar with the basics of Rust and C interoperability and are looking for a way to automate the creation of accurate C headers from their Rust code.
cheadergen sits in PulseGate's API design, testing & docs category. It focuses on automating the generation of accurate C headers for Rust libraries with C-compatible APIs. cheadergen is an open-source project aimed at rust developers. The project is open source (Apache-2.0). The product ships for the web and the command line, and it can be self-hosted.
cheadergen first shipped in 2026. The project is developed in the open on GitHub with 26 stars and 76 commits in the last 90 days. Among its 5 catalogued features are C header generation, multi-crate support, and macro-aware.
Latest indexed changes and source events
Cheadergen: Generate C headers for your Rust package(s) verified by the PulseGate indexer
Other apps tracked under the same category.