goroutines
channels
go fmt
接下来,我将介绍几种调用方法,并简单进行一下这些方法之间的横向比较.主要参考了
building python modules with go 1.5
package main
import "C"
// Add add a+b
func Add(a, b int) int {
sum := make(chan int)
go func() {
sum <- a + b
}()
c := <-sum
return c
}
func main() {}
Add
- 查看 buildmode help
$ go help buildmode
- 编译
$ go build -buildmode=c-shared -o sum.so go_plus.go
$ ls -sh|grep sum
得到这个sum.so有1.3M
python环境是3.5.3