-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add adjustWasmImports incoming Module setting #23794
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
base: main
Are you sure you want to change the base?
Conversation
This provides a way to add symbols to the wasmImports dynamically. This doesn't allow anything new compared to `instantiateWasm` except that it doesn't interfere with sourcemaps or ASAN and it doesn't require reproducing the somewhat tricky behavior in the standard `instantiateWasm` function. As an alternative, we could expose something like `instantiateWasmDefault` to the user, and then they could do this like: ```js Module['instantiateWasm'] = (imports, successCallback) => { adjustWasmImports(imports); instantiateWasmDefault(imports, successCallback); } ```
Can you say more about why you want to be able to do this? e.g. Are you looking to wrap/modify the existing imports, or simply add new ones? |
I originally added this in order to make JSPI work with emscripten js exceptions by replacing the I would say that it doesn't make much sense to restrict it to adding new imports because |
The main problem I have adding new hooks like this it add yet more combinations of settings that we need to test and maintains. I wonder if we could find some other possible ways to solve these problems. Its kind of a shame |
What about my idea of exposing |
If we could do it at no codesize code that seems reasonable. I suppose we would need to pass it as an augment to instantiateWasm somehow? (Because the |
Yeah passing it as an argument would make sense to me. |
This provides a way to add symbols to the
wasmImports
dynamically. This doesn't allow anything new compared toinstantiateWasm
except that it doesn't interfere with sourcemaps or ASAN and it doesn't require reproducing the somewhat tricky behavior in the standardinstantiateWasm
function.As an alternative, we could expose something like
instantiateWasmDefault
to the user, and then they could do this like: