-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
UTF8ToString does not work when compiling for 64bit #23325
Comments
This is expected atm, hence that assertion on it: emscripten/src/library_strings.js Line 120 in 8046a49
However, I agree that this is confusing: in wasm64, a pointer is a bigint, and it would be nice for functions that receive pointers to handle that. @sbc100 what do you think? |
@ptc-jpharvey for now you can work around this with |
The way emscripten works today is that it converts pointers to int64 (number) so the JS code can assume that pointers are int53 numbers. However we currently an automatic way to do this conversion for IIRC this is because we dont have any way to distinguish between pointers and non-pointer EM_JS arguments. So for EM_JS and EM_ASM one currently needs to do this conversion to int64 yourself. We should probably have more docs on how to do this.. |
Here is the issue: #16975. Maybe we can close this as a dup of that? |
Sure. I'll comment there. |
Please include the following in your bug report:
Version of emscripten/emsdk:
3.1.72
Failing command line in full:
em++ -o test.html -sMEMORY64=1 -g -fexceptions test.cpp
At runtime the method says it can only take a number not a bigint
test.js:550
Aborted(Assertion failed: UTF8ToString expects a number (got bigint))
test.js:568
Uncaught RuntimeError: Aborted(Assertion failed: UTF8ToString expects a number (got bigint))
at abort (test.js:568:11)
at assert (test.js:286:5)
at UTF8ToString (test.js:1080:7)
at SetCanvasAsEventTarget (test.js:922:60)
at invoke_vj (test.js:1592:37)
at test.wasm.main (test.wasm:0xded)
at test.js:1697:49
at test.js:620:12
at callMain (test.js:2045:15)
at doRun (test.js:2095:23)
If bigint is allowed through or assertions are disabled then the code fails in UTF8ArrayToString due to mixing types (bigint & number) etc.
The text was updated successfully, but these errors were encountered: