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

#336 in Windows APIs

Download history 3188990/week @ 2024-12-03 3206044/week @ 2024-12-10 2825798/week @ 2024-12-17 1406352/week @ 2024-12-24 1880882/week @ 2024-12-31 3193255/week @ 2025-01-07 3241149/week @ 2025-01-14 3295720/week @ 2025-01-21 3570185/week @ 2025-01-28 3391862/week @ 2025-02-04 3561568/week @ 2025-02-11 3625170/week @ 2025-02-18 3681261/week @ 2025-02-25 4014260/week @ 2025-03-04 4195689/week @ 2025-03-11 4274160/week @ 2025-03-18

16,791,395 downloads per month
Used in 75,358 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