preparing to try libiwasm
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 8 Mar 2022 00:48:31 +0000 (18:48 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 8 Mar 2022 00:48:31 +0000 (18:48 -0600)
build.sh
src/wasm_runtime.c

index 73da61e1e1301793e6d0a473b6f8abc54273c672..147040b7ee480f718edd6973af8d81552518e92e 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -24,6 +24,7 @@ if [ ! -f "$CORE_DIR/lib/libwasmer.so" ]; then
     sudo mkdir -p "$CORE_DIR/lib"
 
     echo "Copying libwasmer to $CORE_DIR/lib (first install)"
+    # sudo cp "$WASMER_LIBRARY_DIR/libiwasm.so" "$CORE_DIR/lib/libiwasm.so"
     sudo cp "$WASMER_LIBRARY_DIR/libwasmer.so" "$CORE_DIR/lib/libwasmer.so"
     sudo cp "$WASMER_LIBRARY_DIR/libwasmer.a" "$CORE_DIR/lib/libwasmer.a"
 fi
index 979f1fc9d8646e45b8f961368a639d7c3a144a04..ff295b60943edf4bd5101d519e379cf64c4d69ce 100644 (file)
     #include <sys/wait.h>
     #include <dlfcn.h>
 #endif
-
-#ifndef WASMER_VERSION
-    #error "Currently, building the Onyx compiler with built-in execution support requires the Wasmer library to be compiled and linked."
-#endif
+// 
+// #ifndef WASMER_VERSION
+//     #error "Currently, building the Onyx compiler with built-in execution support requires the Wasmer library to be compiled and linked."
+// #endif
 
 static wasm_config_t*    wasm_config;
 static wasm_engine_t*    wasm_engine;
@@ -215,6 +215,9 @@ b32 onyx_run_wasm(bh_buffer wasm_bytes, int argc, char *argv[]) {
     bh_arr_new(bh_heap_allocator(), linkable_functions, 4);
     onyx_lookup_and_load_custom_libraries(wasm_bytes);
 
+    // void wasm_runtime_init();
+    // wasm_runtime_init();
+
     wasmer_features_t* features = NULL;
     wasm_trap_t* run_trap = NULL;
 
@@ -249,6 +252,8 @@ b32 onyx_run_wasm(bh_buffer wasm_bytes, int argc, char *argv[]) {
     wasm_module_imports(wasm_module, &module_imports);
 
     wasm_imports = (wasm_extern_vec_t) WASM_EMPTY_VEC;
+    // wasm_imports.data = malloc(module_imports.size * 64);
+    // wasm_imports.size = module_imports.size;
     wasm_extern_vec_new_uninitialized(&wasm_imports, module_imports.size); // @Free
 
     fori (i, 0, (i32) module_imports.size) {