- Drop the workspace [patch.crates-io] and restore windows-link's crates.io source and checksum in Cargo.lock, so every normal build keeps the checksum-verified crate. windows7.ps1 now applies vendor/windows-link with --config, checks that only windows-link's lock entry moved, builds and tests with --locked, checks the patched crate is the one in use, and restores Cargo.lock afterwards. - windows7.yml runs on demand and weekly instead of on every PR, pins every action by commit SHA, and leaves the dependency check and host tests to the script (-Test) so the Cargo arguments live in one place. - ROADMAP, README, NOTICE and docs: experimental, unsupported, not verified by maintainers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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);
}