Skip to content

Instantly share code, notes, and snippets.

@lu-zero
Created October 15, 2020 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lu-zero/6d283c4db227e1d8f995f1227be4668b to your computer and use it in GitHub Desktop.
Save lu-zero/6d283c4db227e1d8f995f1227be4668b to your computer and use it in GitHub Desktop.
/* automatically generated by rust-bindgen */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FooA {
pub a: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_FooA() {
assert_eq!(
::std::mem::size_of::<FooA>(),
4usize,
concat!("Size of: ", stringify!(FooA))
);
assert_eq!(
::std::mem::align_of::<FooA>(),
4usize,
concat!("Alignment of ", stringify!(FooA))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<FooA>())).a as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(FooA), "::", stringify!(a))
);
}
extern "C" {
pub fn foo_new_a() -> *mut FooA;
}
extern "C" {
pub fn foo_compute_a(a: *const FooA) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn foo_destroy_a(a: *mut *mut FooA);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FooB {
pub msg: *mut ::std::os::raw::c_char,
}
#[test]
fn bindgen_test_layout_FooB() {
assert_eq!(
::std::mem::size_of::<FooB>(),
8usize,
concat!("Size of: ", stringify!(FooB))
);
assert_eq!(
::std::mem::align_of::<FooB>(),
8usize,
concat!("Alignment of ", stringify!(FooB))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<FooB>())).msg as *const _ as usize },
0usize,
concat!("Offset of field: ", stringify!(FooB), "::", stringify!(msg))
);
}
extern "C" {
pub fn foo_new_b(msg: *const ::std::os::raw::c_char) -> *mut FooB;
}
extern "C" {
pub fn foo_print_b(b: *mut FooB);
}
extern "C" {
pub fn foo_destroy_b(b: *mut *mut FooB);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment