示例代码:
package simple import ( "fmt" "gopy" ) func example(args *py.Tuple) (py.Object, error) { fmt.Printf("simple.example: %v\n", args) py.None.Incref() return py.None, nil } func init() { methods := []py.Method{ {"example", example, "example function"}, } _, err := py.InitModule("simple", methods) if err != nil { panic(err) } }
github开源项目地址:https://github.com/qur/gopy
查看更多关于Go语言编写CPython扩展goPy的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did86854