Blazor wasm dynamic linking native sidemodules
### Is there an existing issue for this? - [X] I have searched the existing issues ### Is your feature request related to a problem? Please describe the problem. I am trying to link a C++ library compiled with Emscripten to a Blazor wasm application, and use pinvoke. Thus far, the only way to link the two is to use static linking via `NativeFileReference`, but emcc contains functionality to dynamically link side modules and a main module. Comparing the generated JS in an app where both the lib and main app are written in C++ to one with Blazor Wasm and `NativeFileReference`, it seems that the code responsible for loading the functions into the `Module` object is missing, thus when the app tries to call them when they are uninitialized and `abort` is called and the whole thing breaks. Trying a different approach of statically linking a part of the C++ code containing C wrapper functions that are PInvoked and dynamically linking the C++ class that is wrapped, the same issue happened after the C function reached a function call. ### Describe the solution you'd like `NativeFileReference` other than accepting relocatable wasm files for static linking, would accept native libs compiled with Emscripten's SIDE_MODULE flag and expand the generated javascript to load them at loadtime. ### Additional context https://github.com/Devsh-Graphics-Programming/GPU-With-C-Sharp-Angular-WASM Thus far this app is on the small end, but we are considering making a robust native wasm libra
Posted by Hazardu on Sep 8, 2022, 10:48 AM
Tags
Related issues
- 2026 - Microsoft Office 365
- [Ubuntu] `ubuntu-latest` label will use Ubuntu 26.04 in November 2026
- Gamut mapping
- [Codex Desktop] Editing and resending a queued message triggers "App-server queued follow-up no longer exists"
- [Windows] ChatGPT 26.820.60940 fails with "invalid transport in mcp_servers.codex_app"; Beta 26.727.40816 works
- [BUG]: infinite loading of videos
Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments
github (SaaS)
2026 - Microsoft Office 365
[Ubuntu] `ubuntu-latest` label will use Ubuntu 26.04 in November 2026
Gamut mapping
[Codex Desktop] Editing and resending a queued message triggers "App-server queued follow-up no longer exists"
[Windows] ChatGPT 26.820.60940 fails with "invalid transport in mcp_servers.codex_app"; Beta 26.727.40816 works
[BUG]: infinite loading of videos
Restore GPT-5.6 Sol’s 372k Codex context window, or provide an opt-in setting
Codex Desktop for macOS repeatedly triggers `syspolicyd` / `trustd` CPU and memory runaway
Blazor wasm dynamic linking native sidemodules
### Is there an existing issue for this? - [X] I have searched the existing issues ### Is your feature request related to a problem? Please describe the problem. I am trying to link a C++ library compiled with Emscripten to a Blazor wasm application, and use pinvoke. Thus far, the only way to link the two is to use static linking via `NativeFileReference`, but emcc contains functionality to dynamically link side modules and a main module. Comparing the generated JS in an app where both the lib and main app are written in C++ to one with Blazor Wasm and `NativeFileReference`, it seems that the code responsible for loading the functions into the `Module` object is missing, thus when the app tries to call them when they are uninitialized and `abort` is called and the whole thing breaks. Trying a different approach of statically linking a part of the C++ code containing C wrapper functions that are PInvoked and dynamically linking the C++ class that is wrapped, the same issue happened after the C function reached a function call. ### Describe the solution you'd like `NativeFileReference` other than accepting relocatable wasm files for static linking, would accept native libs compiled with Emscripten's SIDE_MODULE flag and expand the generated javascript to load them at loadtime. ### Additional context https://github.com/Devsh-Graphics-Programming/GPU-With-C-Sharp-Angular-WASM Thus far this app is on the small end, but we are considering making a robust native wasm libra
Comments (0)
No comments yet. Start the discussion.