Skip to content

WASM: Support for setting an imported function's module name #454

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

Closed
wants to merge 1 commit into from

Conversation

pkedy
Copy link
Contributor

@pkedy pkedy commented Jul 20, 2019

I need to compile a WebAssembly program that imports functions from a host that uses a module namespace other than the standard env. I enhanced go:export to support this. For example, in addition to the default export (env module)

//go:export multiply
func multiply(x, y int) int {
    return x * y;
}

You can set the module using //go:export [module] <name>

//go:export math multiply
func multiply(x, y int) int {
    return x * y;
}

Alternatively, you can use a separate comment //go:module <name> in conjunction with go:export or go:linkname. I'm happy to make any tweaks to the argument format.

I tried to run make test but got clang linker errors. I tested using go install and wasm2wat to print the imports of the compiled wasm.

I believe this fixes #423.

@CryZe
Copy link

CryZe commented Jul 20, 2019

It doesn‘t fix the issue, but it‘s a large step towards it.

@pkedy
Copy link
Contributor Author

pkedy commented Jul 20, 2019

Oops. I need to reopen this targeting the dev branch.

@pkedy pkedy closed this Jul 20, 2019
@pkedy
Copy link
Contributor Author

pkedy commented Jul 20, 2019

Reopened in #455

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.

Use WASI instead of CommonWA
2 participants