Crates.io | windows-bindgen |
lib.rs | windows-bindgen |
version | |
source | src |
created_at | 2021-10-18 14:45:50.46351+00 |
updated_at | 2025-03-18 14:28:02.944502+00 |
description | Code generator for Windows metadata |
homepage | |
repository | https://github.com/microsoft/windows-rs |
max_upload_size | |
id | 466812 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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());
}
}