nac3_sca/nac3standalone/demo/demo.rs

30 lines
460 B
Rust
Raw Normal View History

2022-01-09 10:51:10 +08:00
#[no_mangle]
pub extern "C" fn output_int32(x: i32) {
println!("{}", x);
}
#[no_mangle]
pub extern "C" fn output_int64(x: i64) {
println!("{}", x);
}
#[no_mangle]
pub extern "C" fn output_asciiart(x: i32) {
let chars = " .,-:;i+hHM$*#@ ";
if x < 0 {
println!("");
} else {
print!("{}", chars.chars().nth(x as usize).unwrap());
}
}
extern "C" {
fn run() -> i32;
}
fn main() {
unsafe {
run();
}
}