6 releases

0.2.1 Oct 6, 2025
0.2.0 Sep 4, 2025
0.1.3 Jun 12, 2025
0.1.1 Mar 18, 2025
0.0.0 Jul 17, 2024

#356 in Windows APIs

Download history 3735418/week @ 2025-10-31 3877520/week @ 2025-11-07 3949421/week @ 2025-11-14 3640712/week @ 2025-11-21 3331045/week @ 2025-11-28 4484694/week @ 2025-12-05 4781095/week @ 2025-12-12 3025730/week @ 2025-12-19 2092478/week @ 2025-12-26 4029320/week @ 2026-01-02 5514132/week @ 2026-01-09 5476343/week @ 2026-01-16 5999758/week @ 2026-01-23 5921286/week @ 2026-01-30 6257406/week @ 2026-02-06 5815532/week @ 2026-02-13

25,268,095 downloads per month
Used in 103,970 crates (31 directly)

MIT/Apache

7KB

Linking for Windows

The windows-link crate provides the link macro that simplifies linking. The link macro is much the same as the one provided by windows-targets but uses raw-dylib and thus does not require import lib files.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-link]
version = "0.2"

Use the link macro to define the external functions you wish to call:

windows_link::link!("kernel32.dll" "system" fn SetLastError(code: u32));
windows_link::link!("kernel32.dll" "system" fn GetLastError() -> u32);

unsafe {
    SetLastError(1234);
    assert_eq!(GetLastError(), 1234);
}

No runtime deps