only-cliches / cpp-wasm-loader

C/C++ to WASM Webpack Loader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error when using the provided example in "WebAssembly.instantiate()"

sudhanshug16 opened this issue · comments

I tried to plug the example in my project but got the following error:
image

my c file:

#include <emscripten.h>

extern "C"
{
	EMSCRIPTEN_KEEPALIVE
	float add(float a, float b) {
		return a + b;
	}
	
}

my js file:

wasm.init().then(function(mod) {
    console.log(mod.exports.add(2, 3));
});

I got the same error,too.

I tried to plug the example in my project but got the following error:
image

my c file:

#include <emscripten.h>

extern "C"
{
	EMSCRIPTEN_KEEPALIVE
	float add(float a, float b) {
		return a + b;
	}
	
}

my js file:

wasm.init().then(function(mod) {
    console.log(mod.exports.add(2, 3));
});

Did you solve the problem?help!! 😄

No. Actually i couldn't solve the problem

Hey, found a way to fix it, just run your webpack with -p flag, have no idea why but it works...

@mskorokhodov I confirm your fix works.