mirror of
https://github.com/guilhermewerner/rust-ffi
synced 2025-06-15 13:24:19 +00:00
13 lines
224 B
Rust
13 lines
224 B
Rust
use libc::c_char;
|
|
use std::ffi::CString;
|
|
|
|
#[no_mangle]
|
|
/// Dealloc a string pointer.
|
|
pub extern "C" fn DeallocString(ptr: *mut c_char) {
|
|
if ptr.is_null() {
|
|
return;
|
|
}
|
|
|
|
unsafe { CString::from_raw(ptr) };
|
|
}
|