Passing an owned Rust string, cleaning up and UB
The Rust Programming Language Forum
Passing an owned Rust string, cleaning up and UB
I'm trying to transfer a Rust string &str across an FFI boundary and think that I am going about it completely backwards. As a first approach, I've decided to create a CString from the provided string, box this into a Box<CStr>, and get a pointer to the underlying C-string, as well as "forget" the box by let string_box = c_string.into_boxed_c_str(); let ptr: *const i8 = string_box.as_ptr(); let _ = Box::into_raw(string_box); This is all well and good for passing the string. Now, I'm concerned...
0 comments
No comments yet.