Skip to content

Conversation

@denis-kudelin
Copy link

@denis-kudelin denis-kudelin commented Jan 24, 2026

Fixes #123570

Summary

Enable LibraryImport to resolve symbols from Emscripten side modules by falling back to dlopen/dlsym after the pinvoke table check, and surface meaningful managed errors on failure.

Motivation

In browser-wasm with MAIN_MODULE/SIDE_MODULE, LibraryImport names are not in the generated pinvoke table. Without a dlopen/dlsym fallback, side modules cannot be resolved even when present.

Changes

  • Attempt dlopen(name) when the pinvoke table does not contain the library.
  • Use dlsym for non-pinvoke handles.
  • Populate error messages (dlerror or name) for managed exceptions.
  • Fix typo in wasm_dl_is_pinvoke_table usage.

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 24, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 24, 2026
@denis-kudelin
Copy link
Author

Contributor

@dotnet-policy-service agree

@jkotas jkotas added area-Interop-mono arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 24, 2026
@denis-kudelin denis-kudelin force-pushed the wasm-dylink-pinvoke branch 9 times, most recently from 1d85720 to c1e7b21 Compare January 24, 2026 05:55
@denis-kudelin denis-kudelin changed the title [browser][mono] Resolve LibraryImport from dylink side modules (#123570) [browser][mono] Resolve LibraryImport via dlopen/dlsym for WASM side modules (#123570) Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Interop-mono community-contribution Indicates that the PR has been added by a community member os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LibraryImport fails to resolve side modules on browser-wasm

2 participants