Use extern type for CStr

This commit is contained in:
Matthias Schiffer 2020-05-01 22:21:17 +02:00
parent fd2384b7fa
commit a205bbb1d2
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
4 changed files with 105 additions and 17 deletions

View file

@ -27,6 +27,11 @@ pub extern "C" fn main(_nargs: libc::c_int, _args: *const *const libc::c_char) -
let _ = writeln!(stdout, "Foo: {} {} {}", z[0], z[1], z[2]);
}
{
let x = libc::string::CString::from("bar");
let _ = stdout.puts(&x);
}
{
let b = alloc::boxed::Box::new(42);
let _ = writeln!(stdout, "Bar: {}", b);