fparkan/vendor/windows-targets
Valentin Popov 1b6a04ca55
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
2024-01-08 01:21:28 +04:00
..
src Initial vendor packages 2024-01-08 01:21:28 +04:00
.cargo-checksum.json Initial vendor packages 2024-01-08 01:21:28 +04:00
Cargo.toml Initial vendor packages 2024-01-08 01:21:28 +04:00
license-apache-2.0 Initial vendor packages 2024-01-08 01:21:28 +04:00
license-mit Initial vendor packages 2024-01-08 01:21:28 +04:00
readme.md Initial vendor packages 2024-01-08 01:21:28 +04:00

Import libs for Windows

The windows-targets crate includes import libs, supports semantic versioning, and optional support for raw-dylib.

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

[dependencies.windows-targets]
version = "0.52"

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

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

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