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")]
|
2012-07-03 18:11:00 -05:00
|
|
|
extern "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 19:53:53 -06:00
|
|
|
log(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-12-30 02:18:55 -06:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2011-08-19 17:16:48 -05:00
|
|
|
fn main() { }
|