-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1065 - liranringel:thiscall, r=fitzgen
Add support for the thiscall ABI Fixes #541 The thiscall ABI is experimental, so in order to use it nightly is required and also the following statement: `#![feature(abi_thiscall)]` That's a problem because the `tests_expectations` crate (in the tests folder) tries to compile it (and stable is required).
- Loading branch information
Showing
7 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] | ||
|
||
|
||
#[repr(C)] | ||
#[derive(Debug, Default, Copy)] | ||
pub struct Foo { | ||
pub _address: u8, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_Foo() { | ||
assert_eq!( | ||
::std::mem::size_of::<Foo>(), | ||
1usize, | ||
concat!("Size of: ", stringify!(Foo)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<Foo>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(Foo)) | ||
); | ||
} | ||
impl Clone for Foo { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] | ||
#![cfg(feature = "nightly")] | ||
#![feature(abi_thiscall)] | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Default, Copy)] | ||
pub struct Foo { | ||
pub _address: u8, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_Foo() { | ||
assert_eq!( | ||
::std::mem::size_of::<Foo>(), | ||
1usize, | ||
concat!("Size of: ", stringify!(Foo)) | ||
); | ||
assert_eq!( | ||
::std::mem::align_of::<Foo>(), | ||
1usize, | ||
concat!("Alignment of ", stringify!(Foo)) | ||
); | ||
} | ||
extern "thiscall" { | ||
#[link_name = "\u{1}?test@Foo@@QAEXXZ"] | ||
pub fn Foo_test(this: *mut Foo); | ||
} | ||
extern "thiscall" { | ||
#[link_name = "\u{1}?test2@Foo@@QAEHH@Z"] | ||
pub fn Foo_test2(this: *mut Foo, var: ::std::os::raw::c_int) -> ::std::os::raw::c_int; | ||
} | ||
impl Clone for Foo { | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} | ||
impl Foo { | ||
#[inline] | ||
pub unsafe fn test(&mut self) { | ||
Foo_test(self) | ||
} | ||
#[inline] | ||
pub unsafe fn test2(&mut self, var: ::std::os::raw::c_int) -> ::std::os::raw::c_int { | ||
Foo_test2(self, var) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// bindgen-flags: --rust-target 1.0 -- --target=i686-pc-windows-msvc | ||
|
||
class Foo { | ||
public: | ||
void test(); | ||
int test2(int var); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// bindgen-flags: --rust-target nightly --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(abi_thiscall)]' -- --target=i686-pc-windows-msvc | ||
|
||
class Foo { | ||
public: | ||
void test(); | ||
int test2(int var); | ||
}; |