Skip to content
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

Dart WASM GC module interop with another Dart WASM GC module #55175

Closed
alienself opened this issue Mar 12, 2024 · 4 comments
Closed

Dart WASM GC module interop with another Dart WASM GC module #55175

alienself opened this issue Mar 12, 2024 · 4 comments
Labels
area-dart2wasm Issues for the dart2wasm compiler. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.

Comments

@alienself
Copy link

alienself commented Mar 12, 2024

Hi,

Is it currently possible to create interops between two compiled dart wasm modules?

The use case would be to have dart library as a wasm module consumed by another "scripting" module.

Is it possible to avoid a js glue layer by sharing the same gc memory?

Otherwise is possible to load/link a dart dynamic library at runtime within a single wasm module? for instance does final dylib = DynamicLibrary.open(path); work on the web?

I have searched everywhere online but unable to get any info about this, I always see a single module being executed.

@dart-github-bot
Copy link
Collaborator

Item Details
Summary User wants to know if it's possible to create interops between two compiled dart wasm modules.
Triage to area-dart2wasm

(what's this?)

@dart-github-bot dart-github-bot added area-dart2wasm Issues for the dart2wasm compiler. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. labels Mar 13, 2024
@devoncarew
Copy link
Member

cc @osa1

@mkustermann
Copy link
Member

Is it currently possible to create interops between two compiled dart wasm modules?

Right now our focus is making one dart app compiled to wasm work well (remaining language/library work, interop with JS, code size, startup, performance, ...).

We do not offer a supported & stable way to interact with other wasm modules yet, but it may come (stay tuned!):

  • Dart app compiled to wasm interact with linear memory wasm: In some sense a variant of dart:ffi for web / wasm. (We do have limited support for a subset of dart:ffi already: It's used by flutter web engine to directly call into another linear-memory wasm module instance, but we consider this as internal for now - as it only supports a subset of our dart:ffi and may require a redesign to work well for wasm). see e.g. [ffi/js-interop/wasm] Unified API for using dart:ffi and JS Interop with WASM #46690
  • Several dart apps compiled to wasm interact with each other: If two dart apps are compiled independently to wasm then they are tree shaken independently atm, so their types may not even be compatible (imagine both apps use a class Foo but one of them uses only field Foo.fieldA and the other Foo.fieldB - then our tree shaker would have different wasm structs for Foo in the two apps, making it not possible to pass an object to another module, ...).

@mkustermann
Copy link
Member

I'm going to close this in favor of two other bugs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart2wasm Issues for the dart2wasm compiler. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.
Projects
None yet
Development

No branches or pull requests

4 participants