Re: [go-nuts] C references to Go functions

2016-12-05 Thread Ian Lance Taylor
On Sat, Dec 3, 2016 at 5:05 PM, gocss wrote: > > gcc call.c -L./main.a -L./main.a tells the linker to add the directory "./main.a" to the search path used to resolve -l options. Since there is no such directory, the option is effectively meaningless. Just write `gcc call.c main.a`. Ian -- Yo

[go-nuts] C references to Go functions

2016-12-03 Thread gocss
I want to call a go function from c. I have file main.go: package main import "fmt" import "C" //export MyFunction func MyFunction(arg1 int) int64 { fmt.Println("GO:MyFunction", "arg1=", arg1) return 1 } func main() { fmt.Println("GO:main") } I build this with: go build -buildmode=c-archi