Skip to content

Avoid duplicate call to _initialize with -f=_initialize#84

Merged
fitzgen merged 2 commits intobytecodealliance:mainfrom
Mrmaxmeier:main
May 18, 2023
Merged

Avoid duplicate call to _initialize with -f=_initialize#84
fitzgen merged 2 commits intobytecodealliance:mainfrom
Mrmaxmeier:main

Conversation

@Mrmaxmeier
Copy link
Contributor

Hi,

I'm using wizer to pre-initialize reactor modules with --init-func="_initialize". wasi-libc recently added a check against calling the reactor initializer multiple times (WebAssembly/wasi-libc#388), which shows that wizer calls it twice in this case. (Once because the reactor initializer is automatically called and a second time because I'm setting it as the init function.)

I think it's reasonable to simply skip the second call for --init-func=_initialize. 🙂

We call the reactor init function automatically before running the
user's init function. Let's not call it twice if the user explicitly
requests `_initialize`.
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks, can you add a test for this?

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks!

@fitzgen fitzgen merged commit 6bbc971 into bytecodealliance:main May 18, 2023
alexcrichton pushed a commit to alexcrichton/wizer that referenced this pull request Oct 8, 2025
Avoid duplicate call to _initialize with `-f=_initialize`
alexcrichton pushed a commit to alexcrichton/wizer that referenced this pull request Oct 8, 2025
Avoid duplicate call to _initialize with `-f=_initialize`
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