Created
January 18, 2019 06:51
-
-
Save paulrouget/eb6297fce179186e0ef544a243c48505 to your computer and use it in GitHub Desktop.
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
Bindgen generates this struct: | |
#[repr(C)] | |
#[derive(Debug, Copy, Clone)] | |
pub struct pthread_mutex_t { | |
pub value: ::std::os::raw::c_int, | |
} | |
That's valid and it works, but everytime I want to use | |
this `pthread_mutex_t` type with `libc::pthread_mutex_lock()` | |
I have to cast it into `libc::pthread_mutex_t`: | |
let libc_mutex_ptr = &mut bindgen_mutex as *mut _ as *mut libc::pthread_mutex_t; | |
This kind of cast happens all over my code. Is there a way to either: | |
1) make it so bindgen re-use libc::pthread_mutex_t instead of creating its own, | |
2) or, have an elegant way to cast from bindgen mutex to libc mutex? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment