alef 0.23.24

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// Write an error message string into an FFI out-error pointer.
///
/// # Safety
///
/// `out_error` must be null or a valid writable `*mut *mut c_char` pointer.
unsafe fn ffi_set_out_error(out_error: *mut *mut std::ffi::c_char, msg: &str) {
    if !out_error.is_null() {
        if let Ok(cs) = std::ffi::CString::new(msg) {
            // SAFETY: out_error is non-null; caller must free this string.
            unsafe { *out_error = cs.into_raw(); }
        }
    }
}