python调用go

2022-04-15  本文已影响0人  lk_erzanml

package main

import "C"

//export Add
func Add(a, b int) int {
return a + b
}

func main(){}

go build -buildmode=c-shared -o libadd.so libadd.go

-- coding:utf-8 --

from ctypes import cdll
libadd=cdll.LoadLibrary("./ttt.so")
result=libadd.Add(24578,3123)
print(result)

上一篇下一篇

猜你喜欢

热点阅读