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

#400 in Windows APIs

Download history 3553118/week @ 2025-01-29 3464097/week @ 2025-02-05 3459135/week @ 2025-02-12 3704219/week @ 2025-02-19 3680211/week @ 2025-02-26 4060735/week @ 2025-03-05 4310748/week @ 2025-03-12 5817185/week @ 2025-03-19 4453526/week @ 2025-03-26 4600318/week @ 2025-04-02 4405240/week @ 2025-04-09 3659762/week @ 2025-04-16 3961584/week @ 2025-04-23 3931087/week @ 2025-04-30 4373110/week @ 2025-05-07 4325762/week @ 2025-05-14

17,322,875 downloads per month
Used in 78,736 crates (17 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