Skip to main content

Crate windows_clang

Crate windows_clang 

Source
Expand description

§windows-clang

The windows-clang crate scrapes C/C++ headers with libclang and emits RDL (Rust Definition Language) source - the text format understood by windows-rdl. It is the header-facing front end of the Win32 metadata pipeline: headers to RDL (this crate) to .winmd (windows-rdl).

Start by adding the following to your Cargo.toml file:

[dependencies.windows-clang]
version = "0.100"

Point it at one or more headers and write the resulting per-header RDL, then feed that RDL to windows_rdl::reader() to compile a .winmd:

windows_clang::clang()
    .input("Example.h")
    .output("rdl")
    .namespace("Example")
    .write_by_header()
    .unwrap();

Structs§

Arch
Target architecture settings that differ between scrape passes.
Clang
Builder that generates RDL from C/C++ headers using libclang.
ScrapePlan
Multi-arch and output state layered on top of a configured Clang.
Summary
What Clang::scrape produced, 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, honoring CLANG_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 name in dirs, returning a forward-slashed path.
libclang_dir
Resolve or fetch the pinned host-arch libclang.dll directory without setting env vars.
nuget_package
Resolve or fetch an exact NuGet package, accepting global-cache or flat restore layouts.