emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Errors passing in uin64_t values with embind

Open jdinh1 opened this issue 7 years ago • 1 comments

Hi,

I'm trying to pass a uint64_t value into a wasm function through JS, using embind, and I'm getting some errors. After reading this section on in64_t, I am under the assumption that this is done automatically behind the hood on JS side? Is this assumption wrong?

C++

#include "emscripten/bind.h"
using namespace emscripten;

int testParam(uint64_t a) {
  return 12345;
}

EMSCRIPTEN_BINDINGS (c) {
    function("testParam", &testParam);
}

emcc command used

emcc --bind test.cpp -Os -s WASM=1 -o test.js -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -std=c++11

Node test

const test = require("./test.js");

test.addOnPostRun(() => {
	console.log(test.testParam(1));
});

Errors

abort({"name":"UnboundTypeError","message":"Cannot call testParam due to unbound types: y","stack":"UnboundTypeError: Cannot call testParam due to unbound types: y\n    at UnboundTypeError.<anonymous>
...

emcc -v

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.29
clang version 6.0.1  (emscripten 1.38.29 : 1.38.29)
Target: x86_64-pc-windows-msvc
Thread model: posix

jdinh1 avatar Mar 21 '19 20:03 jdinh1

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

stale[bot] avatar Mar 21 '20 18:03 stale[bot]