From 69c9e6031abc309bd801e798a0d5d530f1e893a7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 9 Aug 2019 21:13:19 +0200 Subject: WIP --- src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main.rs') 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 } -- cgit v1.2.3