Closed ghenry closed 2 months ago
The layout tests were intentionally switched to built-time tests, that's the:
const _: () = {
["Size of sip_message_event"][::std::mem::size_of::<sip_message_event>() - 64usize];
["Alignment of sip_message_event"][::std::mem::align_of::<sip_message_event>() - 8usize];
["Offset of field: sip_message_event::packet"]
[::std::mem::offset_of!(sip_message_event, packet) - 0usize];
So this is somewhat intentional?
We have the old code gated on offset_of
being stable (so you can get it by downgrading the --rust-target
), but is there a strong reason to prefer the #[test]
variant to the compile-time variant?
We have the old code gated on
offset_of
being stable (so you can get it by downgrading the--rust-target
), but is there a strong reason to prefer the#[test]
variant to the compile-time variant?
No strong reason. Just thought I'd done something wrong :-)
One other question. This has generated a:
pub type pthread_t = ::std::os::raw::c_ulong;
pub type sa_family_t = ::std::os::raw::c_ushort;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [::std::os::raw::c_char; 14usize],
}
which is just libc::socket
Is there a way to tell the Builder this? I've read:
and have ended up here because I needed to get from SocketAddr to socket, so am using:
https://docs.rs/os_socketaddr/latest/os_socketaddr/
Trying to resolve:
mismatched types [E0308] expected `sockaddr`, found `libc::sockaddr` Note: `libc::sockaddr` and `sockaddr` have similar names, but are actually distinct types Note: `libc::sockaddr` is defined in crate `libc` Note: `sockaddr` is defined in the current crate Note: function defined here
Probably my beginner level again.
Thanks.
Sorted it out:
let peer_addr_c: OsSocketAddr = peer_addr.into();
peer_addr_c.as_mut_ptr() as *mut sockaddr,
I'm closing this issue as the root issue has been clarified.
Just following the tut and notice no tests at the
cargo test
stage? There was when I ranbindgen
by hand like so:Here are the ones I generated by hand:
Input C/C++ Header
wrapper.h
:https://github.com/SentryPeer/SentryPeer/blob/main/src/conf.h https://github.com/SentryPeer/SentryPeer/blob/main/src/sip_message_event.h https://github.com/SentryPeer/SentryPeer/blob/main/src/sip_daemon.h
Bindgen Invocation
My
lib.rs
;My
bindings.rs
:Expected Results
to show layout tests like before?
Thanks.