windows-targets

Crates.iowindows-targets
lib.rswindows-targets
version0.53.4
created_at2022-09-09 14:29:19.927693+00
updated_at2025-09-25 18:09:05.432142+00
descriptionImport libs for Windows
homepage
repositoryhttps://github.com/microsoft/windows-rs
max_upload_size
id661906
size21,668
Kenny Kerr (kennykerr)

documentation

README

Import libs for Windows

The windows-targets crate includes import libs, supports semantic versioning, and optional support for raw-dylib.

Note: As of Rust 1.71, the windows-link crate should be preferred.

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

[dependencies.windows-targets]
version = "0.53"

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

unsafe {
    SetLastError(1234);
    assert_eq!(GetLastError(), 1234);
}
Commit count: 1734

cargo fmt