matrix-authentication-service/.gear/predownloaded-development/vendor/windows-link-0.1.3
2026-03-07 01:41:31 +03:00
..
src added rust vendor 2026-03-07 01:41:31 +03:00
.cargo-checksum.json added rust vendor 2026-03-07 01:41:31 +03:00
.cargo_vcs_info.json added rust vendor 2026-03-07 01:41:31 +03:00
Cargo.lock added rust vendor 2026-03-07 01:41:31 +03:00
Cargo.toml added rust vendor 2026-03-07 01:41:31 +03:00
Cargo.toml.orig added rust vendor 2026-03-07 01:41:31 +03:00
license-apache-2.0 added rust vendor 2026-03-07 01:41:31 +03:00
license-mit added rust vendor 2026-03-07 01:41:31 +03:00
readme.md added rust vendor 2026-03-07 01:41:31 +03:00

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.1"

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);
}