Expand description
§bnd-clang
bnd-clang is bnd’s maintained fork of
windows-clang. It parses C and
C++ headers with libclang and emits Rust Definition Language (RDL) source
for windows-rdl to compile into
WinMD metadata.
The package keeps the upstream-compatible windows_clang Rust library name.
§Requirements
Install libclang through the host package manager. On Ubuntu:
sudo apt-get install libclang-devThe default feature set links libclang at build time. Enable the runtime
feature to use clang-sys runtime loading instead.
§Usage
[build-dependencies]
windows-clang = { package = "bnd-clang", version = "0.0.8" }
windows-rdl = { version = "0.100", default-features = false }windows_clang::clang()
.input("example.h")
.args(["-x", "c", "-std=c11"])
.filter("example.h")
.namespace("example")
.library("example")
.output("example.rdl")
.write()
.expect("generate RDL");
windows_rdl::reader()
.input("example.rdl")
.output("example.winmd")
.write()
.expect("compile WinMD");For package generation, write_by_header() emits flat RDL partitions and
remap_by_header() converts the compiled WinMD into canonical
defining-header namespaces. The remapper round-trips through RDL to restore
external TypeRef scopes.
See VENDORED.md for the upstream revision, licensing, and
the maintained fork changes.
§License
MIT or Apache-2.0
Structs§
- Arch
- Target architecture settings that differ between scrape passes.
- Clang
- Builder that generates RDL from C/C++ headers using libclang.
- Header
Remap - Structurally remaps flat metadata into defining-header namespaces.
- Scrape
Plan - Multi-arch and output state layered on top of a configured
Clang. - Summary
- What
Clang::scrapeproduced, for the caller’s summary output.
Constants§
- LIBCLANG_
VERSION - Pinned libclang version; macro capture changes across major versions.
Functions§
- assert_
libclang_ version - Assert the loaded libclang matches
LIBCLANG_VERSION. - clang
- Creates a libclang-backed RDL generator.
- clang_
resource_ dir - Resolve the version-matched clang
-resource-dir, honoringCLANG_RESOURCE_DIR. - clang_
version - Returns the loaded libclang version string.
- ensure_
libclang - Ensure libclang is loadable, respecting an existing
LIBCLANG_PATH. - find_
in_ dirs - Find
nameindirs, returning a forward-slashed path. - libclang_
dir - Resolve or fetch the pinned host-arch
libclang.dlldirectory without setting env vars. - nuget_
package - Resolve or fetch an exact NuGet package, accepting global-cache or flat restore layouts.
- remap_
by_ header - Creates a remapper for flat per-header RDL and WinMD output.