Crates.io | windows-targets |
lib.rs | windows-targets |
version | 0.52.6 |
source | src |
created_at | 2022-09-09 14:29:19.927693 |
updated_at | 2024-07-03 19:44:18.100049 |
description | Import libs for Windows |
homepage | |
repository | https://github.com/microsoft/windows-rs |
max_upload_size | |
id | 661906 |
size | 18,989 |
The windows-targets crate includes import libs, supports semantic versioning, and optional support for raw-dylib.
Start by adding the following to your Cargo.toml file:
[dependencies.windows-targets]
version = "0.52"
Use the link
macro to define the external functions you wish to call:
windows_targets::link!("kernel32.dll" "system" fn SetLastError(code: u32));
windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> u32);
fn main() {
unsafe {
SetLastError(1234);
assert_eq!(GetLastError(), 1234);
}
}