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

#53 in #dll

Download history 1126753/week @ 2026-03-03 7407437/week @ 2026-03-10 7007548/week @ 2026-03-17 6611027/week @ 2026-03-24 6639476/week @ 2026-03-31 7281047/week @ 2026-04-07 7783271/week @ 2026-04-14 8207614/week @ 2026-04-21 9197660/week @ 2026-04-28 10104088/week @ 2026-05-05 11235135/week @ 2026-05-12 10635167/week @ 2026-05-19 11044038/week @ 2026-05-26 9227152/week @ 2026-06-02

43,870,039 downloads per month
Used in 137,377 crates (34 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