/// 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(); }
}
}
}