Debian Codegraph @

.cargo/vendor/windows-targets/readme.md

raw
1 ## Import libs for Windows
2
3 The [windows-targets](https://crates.io/crates/windows-targets) crate includes import libs, supports semantic versioning, and optional support for raw-dylib.
4
5 * [Getting started](https://kennykerr.ca/rust-getting-started/)
6 * [Samples](https://github.com/microsoft/windows-rs/tree/0.56.0/crates/samples) <!-- link to samples for upcoming release -->
7 * [Releases](https://github.com/microsoft/windows-rs/releases)
8
9 Start by adding the following to your Cargo.toml file:
10
11 ```toml
12 [dependencies.windows-targets]
13 version = "0.52"
14 ```
15
16 Use the `link` macro to define the external functions you wish to call:
17
18 ```rust,no_run
19 windows_targets::link!("kernel32.dll" "system" fn SetLastError(code: u32));
20 windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> u32);
21
22 fn main() {
23 unsafe {
24 SetLastError(1234);
25 assert_eq!(GetLastError(), 1234);
26 }
27 }
28 ```