1 //! This is a separate file containing helpers for tests of this library. It is built into a 2 //! dynamic library by the build.rs script. 3 #![crate_type="cdylib"] 4 5 #[no_mangle] 6 pub static mut TEST_STATIC_U32: u32 = 0; 7 8 #[no_mangle] 9 pub static mut TEST_STATIC_PTR: *mut () = 0 as *mut _; 10 11 #[no_mangle] test_identity_u32(x: u32) -> u3212pub extern "C" fn test_identity_u32(x: u32) -> u32 { 13 x 14 } 15 16 #[repr(C)] 17 pub struct S { 18 a: u64, 19 b: u32, 20 c: u16, 21 d: u8 22 } 23 24 #[no_mangle] test_identity_struct(x: S) -> S25pub extern "C" fn test_identity_struct(x: S) -> S { 26 x 27 } 28 29 #[no_mangle] test_get_static_u32() -> u3230pub unsafe extern "C" fn test_get_static_u32() -> u32 { 31 TEST_STATIC_U32 32 } 33 34 #[no_mangle] test_check_static_ptr() -> bool35pub unsafe extern "C" fn test_check_static_ptr() -> bool { 36 TEST_STATIC_PTR == (&mut TEST_STATIC_PTR as *mut *mut _ as *mut _) 37 } 38