2018-11-13 19:19:23 -08:00
|
|
|
use libc::printf as _printf;
|
|
|
|
|
2019-01-22 13:02:06 -06:00
|
|
|
use wasmer_runtime_core::Instance;
|
2018-11-13 19:19:23 -08:00
|
|
|
|
2018-11-20 20:11:58 +01:00
|
|
|
/// putchar
|
|
|
|
pub use libc::putchar;
|
|
|
|
|
|
|
|
/// printf
|
2018-11-13 19:19:23 -08:00
|
|
|
pub extern "C" fn printf(memory_offset: i32, extra: i32, instance: &Instance) -> i32 {
|
2018-12-17 23:54:00 -06:00
|
|
|
debug!("emscripten::printf {}, {}", memory_offset, extra);
|
2018-11-25 13:51:21 -05:00
|
|
|
unsafe {
|
|
|
|
let addr = instance.memory_offset_addr(0, memory_offset as _) as _;
|
|
|
|
_printf(addr, extra)
|
|
|
|
}
|
2018-11-13 19:19:23 -08:00
|
|
|
}
|