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

#295 in Windows APIs

Download history 1410607/week @ 2024-12-23 1725471/week @ 2024-12-30 3053456/week @ 2025-01-06 3395997/week @ 2025-01-13 3138230/week @ 2025-01-20 3553059/week @ 2025-01-27 3418186/week @ 2025-02-03 3683848/week @ 2025-02-10 3461742/week @ 2025-02-17 3674847/week @ 2025-02-24 3952841/week @ 2025-03-03 4136889/week @ 2025-03-10 5002910/week @ 2025-03-17 5320925/week @ 2025-03-24 4397851/week @ 2025-03-31 4373322/week @ 2025-04-07

19,322,286 downloads per month
Used in 76,232 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