So, I'm trying to create a WebAssembly module from an ArrayBuffer.
C code:
#include <stdio.h>
int main() {
printf("hello, world!\n");
return 0;
}
I will compile it like this:
$ emcc -O2 hello.c -s WASM=1 -o hello.html
I am running a local http server. And I'm trying to download it in my browser like this:
fetch('hello.wasm')
.then(res => res.arrayBuffer())
.then(buff => WebAssembly.Module(buff));
And I get the following error:
Unprepared (in promise) RangeError: WebAssembly.Module (): The Wasm compilation exceeds the internal limits in this context for the arguments provided with fetch.then.then.buff (: 1: 77) with
I have nothing to do with this error, and I can not find anything through a web search.
Any help was kindly appreciated.
Thank!
source
share