Sunbeam Studios

Our open-source projects, here for you!

windows-link (0.2.1)

Published 2026-03-26 11:06:12 +00:00 by siennathesane

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add windows-link@0.2.1

About this package

Linking for Windows

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);
}
Details
Cargo
2026-03-26 11:06:12 +00:00
0
MIT OR Apache-2.0
6.0 KiB
Assets (1)
Versions (1) View all
0.2.1 2026-03-26