30 breaking releases

new 0.61.1 May 15, 2025
0.61.0 Mar 18, 2025
0.60.0 Feb 21, 2025
0.58.0 Jul 3, 2024
0.0.0 Oct 18, 2021

#337 in FFI

Download history 37421/week @ 2025-01-25 40515/week @ 2025-02-01 41423/week @ 2025-02-08 34742/week @ 2025-02-15 40707/week @ 2025-02-22 36264/week @ 2025-03-01 39226/week @ 2025-03-08 41620/week @ 2025-03-15 42209/week @ 2025-03-22 38759/week @ 2025-03-29 42178/week @ 2025-04-05 34030/week @ 2025-04-12 34587/week @ 2025-04-19 39854/week @ 2025-04-26 38374/week @ 2025-05-03 30182/week @ 2025-05-10

147,336 downloads per month
Used in 100 crates (7 directly)

MIT/Apache

8.5MB
10K SLoC

Contains (DOS exe, 24MB) default/Windows.Win32.winmd, (Windows exe, 7.5MB) default/Windows.winmd, (DOS exe, 1MB) default/Windows.Wdk.winmd

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.61"

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());
    }
}

Dependencies

OSZAR »