tree: 26a5dc465993f41037e2fef1594784b0b702c11e [path history] [tgz]
  1. src/
  2. .cargo-checksum.json
  3. Cargo.toml
  4. license-apache-2.0
  5. license-mit
  6. readme.md
vendor/windows-targets-0.52.6/readme.md

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