diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-08-09 21:13:19 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-08-09 21:13:19 +0200 |
commit | 69c9e6031abc309bd801e798a0d5d530f1e893a7 (patch) | |
tree | 13e4d571508082d8738d68c5fe7a5339482bceb4 /src/main.rs | |
parent | 0abdc827c9aa9e3f64d31d62663ea232863e4e76 (diff) | |
download | neco-69c9e6031abc309bd801e798a0d5d530f1e893a7.tar neco-69c9e6031abc309bd801e798a0d5d530f1e893a7.zip |
WIP
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 } |