mirror of
https://github.com/tribufu/sdk-rust
synced 2025-06-16 19:14:18 +00:00
Generate native bindings from rust crate
This commit is contained in:
16
src/native/mem.rs
Normal file
16
src/native/mem.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::c_char;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tribufu_free_string(ptr: *mut c_char) {
|
||||
if ptr.is_null() {
|
||||
return;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
let _ = CString::from_raw(ptr);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user