windows-bindgen

Crates.iowindows-bindgen
lib.rswindows-bindgen
version0.58.0
sourcesrc
created_at2021-10-18 14:45:50.46351
updated_at2024-07-03 19:45:19.372912
descriptionWindows metadata compiler
homepage
repositoryhttps://github.com/microsoft/windows-rs
max_upload_size
id466812
size32,714,026
Kenny Kerr (kennykerr)

documentation

README

Generate Rust bindings for Windows

The windows-bindgen crate automatically generates Rust bindings from Windows metadata.

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

[dependencies.windows-targets]
version = "0.52"

[dev-dependencies.windows-bindgen]
version = "0.58"

Generates Rust bindings in a build script or test as needed:

#[test]
fn bindgen() {
    let args = [
        "--out",
        "src/bindings.rs",
        "--config",
        "flatten",
        "--filter",
        "Windows.Win32.System.SystemInformation.GetTickCount",
    ];

    windows_bindgen::bindgen(args).unwrap();
}

mod bindings;

fn main() {
    unsafe {
        println!("{}", bindings::GetTickCount());
    }
}
Commit count: 1510

cargo fmt