#[link(wasm_import_module = "tex")] unsafe extern "C" { fn tex_putchar(c: i32); fn tex_flush(); } #[unsafe(no_mangle)] pub extern "C" fn tex_hello(a: i32, b: i32) { tex_sprint(&format!("Hello \\LaTeX{{}} from Rust! ${a} + {b} = {}$", a+b)); } fn tex_sprint(s: &str) { for c in s.chars() { unsafe { tex_putchar(c as i32) }; } unsafe { tex_flush() }; }