]> git.lizzy.rs Git - rust.git/blob - src/test/ui/abi/x86stdcall.rs
Rollup merge of #95353 - jyn514:invalid-filter-hard-error, r=Mark-Simulacrum
[rust.git] / src / test / ui / abi / x86stdcall.rs
1 // run-pass
2 // ignore-wasm32-bare no libc to test ffi with
3 // ignore-sgx no libc
4 // GetLastError doesn't seem to work with stack switching
5
6 #[cfg(windows)]
7 mod kernel32 {
8   extern "system" {
9     pub fn SetLastError(err: usize);
10     pub fn GetLastError() -> usize;
11   }
12 }
13
14
15 #[cfg(windows)]
16 pub fn main() {
17     unsafe {
18         let expected = 1234;
19         kernel32::SetLastError(expected);
20         let actual = kernel32::GetLastError();
21         println!("actual = {}", actual);
22         assert_eq!(expected, actual);
23     }
24 }
25
26 #[cfg(any(target_os = "android",
27           target_os = "dragonfly",
28           target_os = "emscripten",
29           target_os = "freebsd",
30           target_os = "fuchsia",
31           target_os = "illumos",
32           target_os = "linux",
33           target_os = "macos",
34           target_os = "netbsd",
35           target_os = "openbsd",
36           target_os = "solaris",
37           target_os = "vxworks"))]
38 pub fn main() { }