Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Read the wasm file bytes
FILE *file = fopen("wasm-sample-app/target.wasm", "r");
fseek(file, 0, SEEK_END);
long len = ftell(file);
uint8_t *bytes = malloc(len);
fseek(file, 0, SEEK_SET);
fread(bytes, 1, len, file);
// Creates a WebAssembly Instance from wasm bytes and imports
wasmer_instance_t *instance = NULL;
wasmer_result_t compile_result = wasmer_instantiate(&instance, bytes, len, imports, 3);
printf("Compile result: %d\n", compile_result);
if (compile_result != WASMER_OK)
assert(compile_result == WASMER_OK);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.