diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 7cdfb3f..15a2640 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,11 +5,16 @@ extern crate libc; mod c; +use core::fmt::Write; + #[no_mangle] -pub extern fn main(_nargs: libc::c_int, _args: *const *const libc::c_char) -> libc::c_int { - let foo = cstr!("Foo! %p\n"); - let x = c::string::CBox::new(()); - unsafe { libc::printf(foo.as_ptr(), &*x as *const ()); } +pub extern "C" fn main(_nargs: libc::c_int, _args: *const *const libc::c_char) -> libc::c_int { + let x = c::string::CString::from("foo"); + let y = c::string::CBox::new(x); + //let foo = cstr!("Foo! %p\n"); + //c::stdio::stdout().puts(foo); + let mut stdout = c::stdio::stdout(); + writeln!(stdout, "Foo: {}", 42); 0 } |