Skip to content

Conversation

@mhmd-azeez
Copy link
Contributor

Context

TinyGo doesn't support Reactor modules yet. While you can use WASI functions in Command modules just fine, you'll have to do some gymnastics in order to make them work in Reactor module functions (i.e. exported functions other than main). This PR adds a new package that does the gymnastics for you, you only need to import it.

Notes:

  1. Since standard Go compiler doesn't support exporting functions yet, this only works with TinyGo
  2. It seems like TinyGo is working on adding official support for Reactor modules, so maybe this is redundant?
  3. Tried to use init function for this, but it seems like init is being called too late in the life cycle. The only downside of explicitly exporting _initialize is the fact that wasmtime CLI refuses to run modules that expose both _start and _initialize. But I don't think this is a deal breaker

@mhmd-azeez mhmd-azeez requested review from bhelx and nilslice January 18, 2024 17:56
@mhmd-azeez mhmd-azeez self-assigned this Jan 18, 2024
@mhmd-azeez
Copy link
Contributor Author

This is related to extism/go-sdk#55

Copy link
Member

@nilslice nilslice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done!

@mhmd-azeez mhmd-azeez merged commit d48f368 into main Jan 18, 2024
@mhmd-azeez mhmd-azeez deleted the feat/reactor-module branch January 18, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants