112a9d9c8Sopenharmony_ci# Library Usage with `build.rs` 212a9d9c8Sopenharmony_ci 312a9d9c8Sopenharmony_ci This is the recommended way to use `bindgen`. 412a9d9c8Sopenharmony_ci 512a9d9c8Sopenharmony_ciOften times C and C++ headers will have platform- and architecture-specific 612a9d9c8Sopenharmony_ci`#ifdef`s that affect the shape of the Rust FFI bindings we need to create to 712a9d9c8Sopenharmony_ciinterface Rust code with the outside world. By using `bindgen` as a library 812a9d9c8Sopenharmony_ciinside your `build.rs`, you can generate bindings for the current target 912a9d9c8Sopenharmony_cion-the-fly. Otherwise, you would need to generate and maintain 1012a9d9c8Sopenharmony_ci`x86_64-unknown-linux-gnu-bindings.rs`, `x86_64-apple-darwin-bindings.rs`, 1112a9d9c8Sopenharmony_cietc... separate bindings files for each of your supported targets, which can be 1212a9d9c8Sopenharmony_cia huge pain. The downside is that everyone building your crate also needs 1312a9d9c8Sopenharmony_ci`libclang` available to run `bindgen`. 1412a9d9c8Sopenharmony_ci 1512a9d9c8Sopenharmony_ci## Library API Documentation 1612a9d9c8Sopenharmony_ci 1712a9d9c8Sopenharmony_ci[ There is complete API reference documentation on docs.rs ](https://docs.rs/bindgen) 1812a9d9c8Sopenharmony_ci 1912a9d9c8Sopenharmony_ci## Tutorial 2012a9d9c8Sopenharmony_ci 2112a9d9c8Sopenharmony_ciThe next section contains a detailed, step-by-step tutorial for using `bindgen` 2212a9d9c8Sopenharmony_cias a library inside `build.rs`. 23