Fix WASM binding resolution across module scopes - #154
Open
Arnold-Seb wants to merge 1 commit into
Open
Conversation
jankiluitel
approved these changes
Aug 18, 2026
jankiluitel
left a comment
There was a problem hiding this comment.
Reviewed the changes and the updated binding resolution approach looks good. The fallback handling across different module scopes improves robustness while keeping the change focused. The implementation is clear and the existing checks are passing. Approved from my side. ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generated C# WASM bindings were failing to load and initialise correctly at runtime. The lookup in
CSharpWasmExpo/main.jsthat resolves each binding method against the WASM module scope only checked a single naming pattern, so methods exposed under a different scope or naming convention (e.g.__sklib_-prefixed keys) were silently missed.Change
Updated the binding resolution logic in
CSharpWasmExpo/main.jsto fall back through multiple lookup strategies when resolving a binding function:globalThis[name]wasmScope[name]wasmScope["_CPP_" + name]wasmScopekey that starts with__sklib_and matches the target nameThis mirrors how the underlying SplashKit bindings are actually exposed across the different generated/module scopes, rather than assuming a single fixed pattern.
Testing
__sklib_prefix and via the iframe-scopedwasmScope) to confirm the fallback resolves them without regressing previously-working lookups.Scope
This PR only touches
CSharpWasmExpo/main.js. No build artifacts or generated files are included.