mirror of
https://git.proxmox.com/git/rustc
synced 2025-10-25 06:55:08 +00:00
| .. | ||
| default | ||
| src | ||
| .cargo-checksum.json | ||
| Cargo.toml | ||
| license-apache-2.0 | ||
| license-mit | ||
| readme.md | ||
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.52"
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());
}
}