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

Comments

@thstart
Copy link

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 commented Oct 1, 2020

Please see #25612, #38248.

I will close this as a duplicate of those issues.

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

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 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants