summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 7cdfb3febf8e58661bbbc8365ea24aed23dde665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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() }
}