Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help #23504

Open
xalteropsx opened this issue Jan 27, 2025 · 1 comment
Open

Need help #23504

xalteropsx opened this issue Jan 27, 2025 · 1 comment

Comments

@xalteropsx
Copy link

xalteropsx commented Jan 27, 2025

#include <emscripten.h>
#include <emscripten/bind.h>

void performWork() {
  int *i = new int;
}
int main(){
    return 0;
}
EMSCRIPTEN_BINDINGS(panda) {
  emscripten::function("performWork", &performWork);
}

emcc -lembind -o panda.wasm panda.cpp

Error loading WASM: TypeError: WebAssembly.instantiate(): Import #0 "env": module is not an object or function

@xalteropsx xalteropsx changed the title basic not working nvm Jan 27, 2025
@xalteropsx xalteropsx changed the title nvm Bug document Jan 27, 2025
@xalteropsx xalteropsx reopened this Jan 27, 2025
@xalteropsx xalteropsx changed the title Bug document Need help Jan 27, 2025
@kripken
Copy link
Member

kripken commented Jan 27, 2025

EMSCRIPTEN_BINDINGS is a way to connect JS and wasm. It will not work with a pure wasm application.

You can use lower-level ways to call into the wasm, if you don't need/want JS. Just using EMSCRIPTEN_KEEPALIVE is enough:

https://emscripten.org/docs/api_reference/emscripten.h.html#compiling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants