How to expose a function with arguments for WebAssembly wasm generation?
thstart opened this issue · 3 comments
thstart commented
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?
thstart commented