pve-lxc-syscalld/vendor/windows-targets
Andrew A. Vasilyev a6268455b9 cargo vendor
2024-02-29 18:27:23 +03:00
..
src cargo vendor 2024-02-29 18:27:23 +03:00
.cargo-checksum.json cargo vendor 2024-02-29 18:27:23 +03:00
Cargo.toml cargo vendor 2024-02-29 18:27:23 +03:00
license-apache-2.0 cargo vendor 2024-02-29 18:27:23 +03:00
license-mit cargo vendor 2024-02-29 18:27:23 +03:00
readme.md cargo vendor 2024-02-29 18:27:23 +03: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.4"

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