2014-12-12 23:39:27 +00:00
|
|
|
// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
|
2013-11-16 18:25:56 -05:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// Make sure Rust generates the correct calling convention for extern
|
|
|
|
// functions.
|
|
|
|
|
|
|
|
#[inline(never)]
|
2013-11-19 12:46:28 -05:00
|
|
|
#[cfg(target_arch = "x86_64")]
|
2015-03-25 17:06:52 -07:00
|
|
|
pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
|
2013-11-16 18:25:56 -05:00
|
|
|
assert!(a == 1);
|
|
|
|
assert!(b == 2);
|
|
|
|
assert!(c == 3);
|
|
|
|
assert!(d == 4);
|
2013-11-19 12:46:28 -05:00
|
|
|
|
2014-10-14 21:07:11 -04:00
|
|
|
println!("a: {}, b: {}, c: {}, d: {}",
|
2013-11-16 18:25:56 -05:00
|
|
|
a, b, c, d)
|
|
|
|
}
|
|
|
|
|
2013-11-19 12:46:28 -05:00
|
|
|
#[inline(never)]
|
2014-12-12 23:39:27 +00:00
|
|
|
#[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "aarch64"))]
|
2015-03-25 17:06:52 -07:00
|
|
|
pub extern fn foo(a: isize, b: isize, c: isize, d: isize) {
|
2013-11-19 12:46:28 -05:00
|
|
|
assert!(a == 1);
|
|
|
|
assert!(b == 2);
|
|
|
|
assert!(c == 3);
|
|
|
|
assert!(d == 4);
|
|
|
|
|
2014-10-14 21:07:11 -04:00
|
|
|
println!("a: {}, b: {}, c: {}, d: {}",
|
2013-11-19 12:46:28 -05:00
|
|
|
a, b, c, d)
|
2013-11-16 18:25:56 -05:00
|
|
|
}
|