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

feat: create separate package to make reactor modules easier #26

Merged
merged 4 commits into from
Jan 18, 2024

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 self-assigned this Jan 18, 2024
@mhmd-azeez
Copy link
Contributor Author

This is related to extism/go-sdk#55

pdk_reactor/go.mod Outdated Show resolved Hide resolved
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
4 checks passed
@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.

2 participants