-
Notifications
You must be signed in to change notification settings - Fork 746
Support --use-core and --ctypes-prefix #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(non_snake_case)] | ||
|
||
#![no_std] | ||
mod libc { pub type c_int = i32; pub enum c_void {} } | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct foo { | ||
pub a: libc::c_int, | ||
pub b: libc::c_int, | ||
pub bar: *mut libc::c_void, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_foo() { | ||
assert_eq!(::core::mem::size_of::<foo>() , 16usize); | ||
assert_eq!(::core::mem::align_of::<foo>() , 8usize); | ||
} | ||
impl Clone for foo { | ||
fn clone(&self) -> Self { *self } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(non_snake_case)] | ||
|
||
extern crate core; | ||
|
||
#[repr(C)] | ||
#[derive(Debug, Copy)] | ||
pub struct foo { | ||
pub a: ::std::os::raw::c_int, | ||
pub b: ::std::os::raw::c_int, | ||
pub bar: *mut ::std::os::raw::c_void, | ||
} | ||
#[test] | ||
fn bindgen_test_layout_foo() { | ||
assert_eq!(::core::mem::size_of::<foo>() , 16usize); | ||
assert_eq!(::core::mem::align_of::<foo>() , 8usize); | ||
} | ||
impl Clone for foo { | ||
fn clone(&self) -> Self { *self } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// bindgen-flags: --ctypes-prefix "libc" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub type c_int = i32; pub enum c_void {} }" | ||
struct foo { | ||
int a, b; | ||
void* bar; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// bindgen-flags: --use-core --raw-line "extern crate core;" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, at least not completely automatically I guess. It's not uncommon doing |
||
|
||
struct foo { | ||
int a, b; | ||
void* bar; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
poor man's libc :)