mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Added emscripten abort function
# Conflicts: # src/linkers/emscripten/mod.rs
This commit is contained in:
parent
7bd2af98b3
commit
b16fceb9d3
9
src/linkers/emscripten/abort.rs
Normal file
9
src/linkers/emscripten/abort.rs
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
use crate::webassembly::Instance;
|
||||
use std::process;
|
||||
|
||||
|
||||
pub extern "C" fn abort(_code: i32, _instance: &Instance) {
|
||||
process::abort();
|
||||
// abort!("Aborted")
|
||||
}
|
@ -2,11 +2,14 @@ use crate::webassembly::{ImportObject, ImportValue};
|
||||
|
||||
mod printf;
|
||||
mod putchar;
|
||||
mod abort;
|
||||
|
||||
pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
|
||||
let mut import_object = ImportObject::new();
|
||||
import_object.set("env", "printf", ImportValue::Func(printf::printf as *const u8));
|
||||
import_object.set("env", "putchar", ImportValue::Func(putchar::putchar as *const u8));
|
||||
import_object.set("env", "abort", ImportValue::Func(abort::abort as *const u8));
|
||||
import_object.set("env", "_abort", ImportValue::Func(abort::abort as *const u8));
|
||||
import_object
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user