| 1 |
//! Utilities related to FFI bindings. |
| 2 |
|
| 3 |
// If we have std, use it. |
| 4 |
#[cfg(not(windows))] |
| 5 |
#[cfg(feature = "std")] |
| 6 |
pub use std::ffi::{CStr, CString, FromBytesWithNulError, NulError}; |
| 7 |
#[cfg(feature = "std")] |
| 8 |
pub use std::os::raw::{ |
| 9 |
c_char, c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void, |
| 10 |
}; |
| 11 |
|
| 12 |
// If we don't have std, we can depend on core and alloc having these features |
| 13 |
// in Rust 1.64+. |
| 14 |
#[cfg(not(windows))] |
| 15 |
#[cfg(all(feature = "alloc", not(feature = "std")))] |
| 16 |
pub use alloc::ffi::{CString, NulError}; |
| 17 |
#[cfg(not(feature = "std"))] |
| 18 |
pub use core::ffi::{ |
| 19 |
c_char, c_int, c_long, c_longlong, c_short, c_uint, c_ulong, c_ulonglong, c_ushort, c_void, |
| 20 |
}; |
| 21 |
#[cfg(not(windows))] |
| 22 |
#[cfg(not(feature = "std"))] |
| 23 |
pub use core::ffi::{CStr, FromBytesWithNulError}; |