An easy way to turn an unsafe *const c_char
into a Rust String type and return a pointer for FFI.
turn_into_pointer(string: String) -> CString
Takes a Rust String type and returns a CString.
make_string(unsafe_string: *const c_char) -> String
Takes a *const c_char
and returns a Rust String
type.
Cargo.toml
[dependencies]
stringer = "0.1.6"
In the file you need the functions
extern crate stringer;
use stringer::*;
Due to the nature of what this library is doing:
- This code is unsafe
- Use at your own risk