I have a C header file which contains string constants
#define SOLCLIENT_SESSION_PROP_USERNAME "SESSION_USERNAME"
and bindgen translates them to
pub const SOLCLIENT_SESSION_PROP_USERNAME: &'static [u8; 17usize] = b"SESSION_USERNAME\0";
(1) How will bindgen behave when C char
is wider that 8 bits. Will it generate u16
array?
(2) If so how to consume the translated constants so my Rust code works both on systems
where char is 8 bits and 16 bits. Currently I use std::ffi::CStr::from_bytes_with_nul()
followed by .as_ptr()
to convert these constants to *const c_char
but that won't work because from_bytes_with_nul
expects u8
slice.