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