diff --git a/src/myrustlib/src/hello.rs b/src/myrustlib/src/hello.rs index f5f999c..925cc15 100644 --- a/src/myrustlib/src/hello.rs +++ b/src/myrustlib/src/hello.rs @@ -1,11 +1,8 @@ -use std; use std::ffi::CString; use std::os::raw::c_char; #[no_mangle] pub extern fn string_from_rust() -> *const c_char { let s = CString::new("Hello ピカチュウ !").unwrap(); - let p = s.as_ptr(); - std::mem::forget(s); - p + s.into_raw() }