15 releases

0.53.0 Jan 7, 2025
0.52.6 Jul 3, 2024
0.52.5 Apr 12, 2024
0.52.4 Feb 28, 2024
0.0.0 Sep 9, 2022

#294 in Windows APIs

Download history 1434272/week @ 2024-12-26 2541521/week @ 2025-01-02 3417902/week @ 2025-01-09 3138847/week @ 2025-01-16 3381889/week @ 2025-01-23 3551910/week @ 2025-01-30 3566345/week @ 2025-02-06 3372304/week @ 2025-02-13 3769450/week @ 2025-02-20 3737689/week @ 2025-02-27 4056289/week @ 2025-03-06 4423328/week @ 2025-03-13 5910098/week @ 2025-03-20 4269321/week @ 2025-03-27 4636842/week @ 2025-04-03 4318507/week @ 2025-04-10

20,025,829 downloads per month
Used in 76,476 crates (15 directly)

MIT/Apache

14MB
52 lines

Import libs for Windows

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

Dependencies