fix windows linking and appveyor build (#166)

This commit is contained in:
Mackenzie Clark
2019-02-08 13:51:29 -08:00
committed by GitHub
parent 1886b3d3c1
commit 9a56680281
7 changed files with 53 additions and 149 deletions

View File

@ -5,14 +5,14 @@ use wasmer_runtime_core::vm::Ctx;
// this cfg_attr will try to link with the legacy lib that does not inline printf
// this will allow for compiliation, but will produce a linker error if there is a problem
// finding printf.
#[cfg_attr(
all(windows, target_env = "msvc"),
link(name = "legacy_stdio_definitions", kind = "static-nobundle")
)]
extern "C" {
#[link_name = "printf"]
pub fn _printf(s: *const c_char, ...) -> c_int;
}
//#[cfg_attr(
// all(windows, target_env = "msvc"),
// link(name = "legacy_stdio_definitions", kind = "static-nobundle")
//)]
//extern "C" {
// #[link_name = "printf"]
// pub fn _printf(s: *const c_char, ...) -> c_int;
//}
/// putchar
pub fn putchar(chr: i32, ctx: &mut Ctx) {
@ -22,8 +22,9 @@ pub fn putchar(chr: i32, ctx: &mut Ctx) {
/// printf
pub fn printf(memory_offset: i32, extra: i32, ctx: &mut Ctx) -> i32 {
debug!("emscripten::printf {}, {}", memory_offset, extra);
unsafe {
let addr = emscripten_memory_pointer!(ctx.memory(0), memory_offset) as _;
_printf(addr, extra)
}
// unsafe {
// let addr = emscripten_memory_pointer!(ctx.memory(0), memory_offset) as _;
// _printf(addr, extra)
// }
-1
}