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

#296 in Windows APIs

Download history 2748156/week @ 2025-01-03 3452155/week @ 2025-01-10 3117946/week @ 2025-01-17 3432398/week @ 2025-01-24 3520142/week @ 2025-01-31 3627574/week @ 2025-02-07 3407637/week @ 2025-02-14 3746824/week @ 2025-02-21 3865031/week @ 2025-02-28 4020166/week @ 2025-03-07 4545912/week @ 2025-03-14 5790465/week @ 2025-03-21 4299397/week @ 2025-03-28 4644770/week @ 2025-04-04 4187604/week @ 2025-04-11 3040706/week @ 2025-04-18

16,927,640 downloads per month
Used in 76,685 crates (16 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