2011-11-09 17:27:11 -06:00
|
|
|
// GetLastError doesn't seem to work with stack switching
|
|
|
|
// xfail-test
|
|
|
|
|
2011-07-18 15:14:33 -05:00
|
|
|
#[cfg(target_os = "win32")]
|
2011-11-09 18:02:21 -06:00
|
|
|
native "stdcall" mod kernel32 {
|
2011-07-27 07:19:39 -05:00
|
|
|
fn SetLastError(err: uint);
|
|
|
|
fn GetLastError() -> uint;
|
2011-07-18 16:59:44 -05:00
|
|
|
}
|
2011-07-18 15:14:33 -05:00
|
|
|
|
2011-11-09 17:27:11 -06:00
|
|
|
|
2011-07-18 16:59:44 -05:00
|
|
|
#[cfg(target_os = "win32")]
|
|
|
|
fn main() {
|
2011-11-09 17:27:11 -06:00
|
|
|
let expected = 1234u;
|
2011-07-27 07:19:39 -05:00
|
|
|
kernel32::SetLastError(expected);
|
|
|
|
let actual = kernel32::GetLastError();
|
2011-12-22 16:42:52 -06:00
|
|
|
log_full(core::error, actual);
|
2011-07-27 07:19:39 -05:00
|
|
|
assert (expected == actual);
|
2011-07-18 15:14:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
#[cfg(target_os = "linux")]
|
2011-08-19 17:16:48 -05:00
|
|
|
fn main() { }
|