Skip to content

Emscripten: Cast pointer arguments to pointer-sized integers#1113

Open
TheComputerGuy96 wants to merge 1 commit intomackron:devfrom
TheComputerGuy96:fix/emscripten-pointer
Open

Emscripten: Cast pointer arguments to pointer-sized integers#1113
TheComputerGuy96 wants to merge 1 commit intomackron:devfrom
TheComputerGuy96:fix/emscripten-pointer

Conversation

@TheComputerGuy96
Copy link
Copy Markdown

For some reason, 64-bit pointer arguments are casted to Numbers in Emscripten's type handling (which causes conversion errors when passing them back to native code)

For some reason, 64-bit pointer arguments are casted to Numbers
in Emscripten's type handling (which causes conversion errors when
passing them back to native code)
@orcmid
Copy link
Copy Markdown

orcmid commented Apr 6, 2026

Without digging into this at all, I am wondering if the original casting to unsigned integers has to do with comparing pointers. There are intrinsics for handling that in a standard manner, rather than faking integers (and assuming x64 :).

@TheComputerGuy96
Copy link
Copy Markdown
Author

Here's a related Emscripten issue: emscripten-core/emscripten#26625

@mackron
Copy link
Copy Markdown
Owner

mackron commented Apr 6, 2026

@TheComputerGuy96 Thanks for this. Do you by chance know if this will break the build for older versions of Emscripten?

Is this a build error or a runtime error by the way?

@TheComputerGuy96
Copy link
Copy Markdown
Author

Do you by chance know if this will break the build for older versions of Emscripten?

Emscripten versions since 3.1.15 should be fine with the MEMORY64 flag set (due to emscripten-core/emscripten@a0ed598) while 32-bit isn't really affected

Is this a build error or a runtime error by the way?

As mentioned in the Emscripten issue, this is a runtime error (specifically TypeError: Cannot convert <number> to a BigInt)

@mackron
Copy link
Copy Markdown
Owner

mackron commented Apr 6, 2026

Thanks. I think this should be fine. Will look at this properly when I do my next pass on miniaudio, but can't see any reason not to merge it so long as it doesn't break older builds (3.1.15 is well old enough).

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

Successfully merging this pull request may close these issues.

3 participants