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

How to expose a function with arguments for WebAssembly wasm generation? #41715

Closed
thstart opened this issue Sep 30, 2020 · 3 comments
Closed

How to expose a function with arguments for WebAssembly wasm generation? #41715

thstart opened this issue Sep 30, 2020 · 3 comments

Comments

@thstart
Copy link

@thstart thstart commented Sep 30, 2020

What version of Go are you using (go version)?

$ go version
go1.15.2

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOOS="darw"

What did you do?

package main

import "C"

//export Sum
func Sum(a, b int) int {
return a + b
}

func main() {
// We need the main function to make possible
// CGO compiler to compile the package as C shared library
}

What did you expect to see?

I want to expose the Sum function which accepts arguments in order to use it
in a non browser environment.

Currently there is no way to do that mucous only main() is exposed.

What did you see instead?

@agnivade
Copy link
Contributor

@agnivade agnivade commented Oct 1, 2020

Please see #25612, #38248.

I will close this as a duplicate of those issues.

@agnivade agnivade closed this Oct 1, 2020
@thstart
Copy link
Author

@thstart thstart commented Oct 1, 2020

Please see #25612, #38248.

I will close this as a duplicate of those issues.

Thank you. I looked at the two links and looks like they are closed.
Could you please tell me what are the plans?
I have a real case - where to explain it with more details?

@agnivade
Copy link
Contributor

@agnivade agnivade commented Oct 1, 2020

As of now, it's very difficult to achieve this without a major change as outlined in #38248. I think once wasi support arrives, this will be available.

You are welcome to comment on those issues if you have any suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.