windows-bindgen 0.60.0

Code generator for Windows metadata
Documentation

Code generator for Windows metadata

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

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

[dependencies.windows-link]
version = "0.1"

[build-dependencies.windows-bindgen]
version = "0.60"

Generate Rust bindings in a build script as follows:

fn main() {
    let args = [
        "--out",
        "src/bindings.rs",
        "--flat",
        "--filter",
        "GetTickCount",
    ];

    windows_bindgen::bindgen(args);
}

And then use the bindings as follows:

mod bindings;

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