15 releases

new 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

#344 in Windows APIs

Download history 2909966/week @ 2024-09-19 3344174/week @ 2024-09-26 3359549/week @ 2024-10-03 3529163/week @ 2024-10-10 3157286/week @ 2024-10-17 3142233/week @ 2024-10-24 2920636/week @ 2024-10-31 3104025/week @ 2024-11-07 3186695/week @ 2024-11-14 3048113/week @ 2024-11-21 2650584/week @ 2024-11-28 3302431/week @ 2024-12-05 3145769/week @ 2024-12-12 2017021/week @ 2024-12-19 1434299/week @ 2024-12-26 2542132/week @ 2025-01-02

9,795,443 downloads per month
Used in 70,386 crates (20 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