diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..7cdfb3f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,19 @@ +#![no_main] +#![no_std] + +extern crate libc; + +mod c; + +#[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 ()); } + 0 +} + +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + unsafe { libc::abort() } +} |