2 // ignore-wasm32-bare no libc to test ffi with
5 #![feature(rustc_private)]
11 use libc::{c_char, size_t};
14 #[link_name = "strlen"]
15 pub fn my_strlen(str: *const c_char) -> size_t;
19 fn strlen(str: String) -> usize {
20 // C string is terminated with a zero
21 let s = CString::new(str).unwrap();
22 unsafe { mlibc::my_strlen(s.as_ptr()) as usize }
26 let len = strlen("Rust".to_string());