112a9d9c8Sopenharmony_ci# Command Line Usage
212a9d9c8Sopenharmony_ci
312a9d9c8Sopenharmony_ciInstall the `bindgen` executable with `cargo`:
412a9d9c8Sopenharmony_ci
512a9d9c8Sopenharmony_ci```bash
612a9d9c8Sopenharmony_ci$ cargo install bindgen-cli
712a9d9c8Sopenharmony_ci```
812a9d9c8Sopenharmony_ci
912a9d9c8Sopenharmony_ciThe `bindgen` executable is installed to `~/.cargo/bin`. You have to add that
1012a9d9c8Sopenharmony_cidirectory to your `$PATH` to use `bindgen`.
1112a9d9c8Sopenharmony_ci
1212a9d9c8Sopenharmony_ci`bindgen` takes the path to an input C or C++ header file, and optionally an
1312a9d9c8Sopenharmony_cioutput file path for the generated bindings. If the output file path is not
1412a9d9c8Sopenharmony_cisupplied, the bindings are printed to `stdout`.
1512a9d9c8Sopenharmony_ci
1612a9d9c8Sopenharmony_ciIf we wanted to generated Rust FFI bindings from a C header named `input.h` and
1712a9d9c8Sopenharmony_ciput them in the `bindings.rs` file, we would invoke `bindgen` like this:
1812a9d9c8Sopenharmony_ci
1912a9d9c8Sopenharmony_ci```bash
2012a9d9c8Sopenharmony_ci$ bindgen input.h -o bindings.rs
2112a9d9c8Sopenharmony_ci```
2212a9d9c8Sopenharmony_ci
2312a9d9c8Sopenharmony_ciFor more details, pass the `--help` flag:
2412a9d9c8Sopenharmony_ci
2512a9d9c8Sopenharmony_ci```bash
2612a9d9c8Sopenharmony_ci$ bindgen --help
2712a9d9c8Sopenharmony_ci```
28