allow building sdk for x86_64

This commit is contained in:
vms 2020-10-06 11:52:17 +03:00
parent de9259b842
commit 39b7641373

View File

@ -144,7 +144,12 @@ impl log::Log for WasmLogger {
record.args() record.args()
); );
unsafe { log_utf8_string(log_msg.as_ptr() as i32, log_msg.len() as i32) }; // this allows compiling sdk on x86_64
if cfg!(target_arch = "wasm32") {
unsafe { log_utf8_string(log_msg.as_ptr() as i32, log_msg.len() as i32) };
} else {
println!("{}", log_msg);
}
} }
// in our case flushing is performed by the VM itself // in our case flushing is performed by the VM itself
@ -153,6 +158,7 @@ impl log::Log for WasmLogger {
} }
/// log_utf8_string should be provided directly by a host. /// log_utf8_string should be provided directly by a host.
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "host")] #[link(wasm_import_module = "host")]
extern "C" { extern "C" {
// Writes a byte string of size bytes that starts from ptr to a logger // Writes a byte string of size bytes that starts from ptr to a logger