Scroll to navigation

CBINDGEN(1) User Commands CBINDGEN(1)


cbindgen - manual page for cbindgen 0.24.3


cbindgen 0.24.3 Generate C bindings for a Rust library


cbindgen [OPTIONS] [INPUT]


A crate directory or source file to generate bindings for. In general this is the folder where the Cargo.toml file of source Rust library resides.


Specify path to a `cbindgen.toml` config to use
Whether to use a new temporary directory for expanding macros. Affects performance, but might be required in certain build processes.
Whether to add C++ compatibility to generated C bindings
If generating bindings for a crate, the specific crate to generate bindings for
Whether to parse dependencies when generating bindings
Print help information
Specify the language to output bindings in [possible values: c++, C++, c, C, cython, Cython]
Specify the path to the Cargo.lock file explicitly. If this is not specified, the Cargo.lock file is searched for in the same folder as the Cargo.toml file. This option is useful for projects that use workspaces.
Specify the path to the output of a `cargo metadata` command that allows to get dependency information. This is useful because cargo metadata may be the longest part of cbindgen runtime, and you may want to share it across cbindgen invocations. By default cbindgen will run `cargo metadata --all-features --format-version 1 --manifest-path <path/to/crate/Cargo.toml>
The file to output the bindings to
Only fetch dependencies needed by the target platform. The target platform defaults to the host platform; set TARGET to override.
Specify the profile to use when expanding macros. Has no effect otherwise. [possible values: Debug, debug, Release, release]
Report errors only (overrides verbosity options).
Specify the declaration style to use for bindings [possible values: Both, both, Tag, tag, Type, type]
Enable verbose logging
Print version information
Generate bindings and compare it to the existing bindings file and error if they are different


The full documentation for cbindgen is maintained as a Texinfo manual. If the info and cbindgen programs are properly installed at your site, the command

info cbindgen

should give you access to the complete manual.

February 2023 cbindgen 0.24.3