2016-04-26 12:51:14 -05:00
|
|
|
// Make sure Rust generates the correct calling convention for extern
|
|
|
|
// functions.
|
|
|
|
|
|
|
|
#[inline(never)]
|
|
|
|
#[cfg(target_arch = "x86_64")]
|
|
|
|
pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
|
|
|
|
assert_eq!(a, 1);
|
|
|
|
assert_eq!(b, 2);
|
|
|
|
assert_eq!(c, 3);
|
|
|
|
assert_eq!(d, 4);
|
|
|
|
|
|
|
|
println!("a: {}, b: {}, c: {}, d: {}",
|
|
|
|
a, b, c, d)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline(never)]
|
|
|
|
#[cfg(not(target_arch = "x86_64"))]
|
2020-09-01 16:28:11 -05:00
|
|
|
pub extern "C" fn foo(a: isize, b: isize, c: isize, d: isize) {
|
2016-04-26 12:51:14 -05:00
|
|
|
assert_eq!(a, 1);
|
|
|
|
assert_eq!(b, 2);
|
|
|
|
assert_eq!(c, 3);
|
|
|
|
assert_eq!(d, 4);
|
|
|
|
|
|
|
|
println!("a: {}, b: {}, c: {}, d: {}",
|
|
|
|
a, b, c, d)
|
|
|
|
}
|