summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 15a26409d49d2839bec10d1febb3e421742ee4fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#![no_main]
#![no_std]

extern crate libc;

mod c;

use core::fmt::Write;

#[no_mangle]
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
}

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
	unsafe { libc::abort() }
}