import ctypes
library = ctypes.cdll.LoadLibrary(os.path.join(os.path.abspath('.'), r'./lib.so'))
SetCallback = library.SetCallback
CLLBKTYPE = ctypes.CFUNCTYPE(ctypes.c_int)
SetCallback .argtypes = [CLLBKTYPE]
class Test:
def __init__(self):
self.setcallback()
def setcallback(self):
SetCallback(CLLBKTYPE(self.callback))
def callback(self):
print("hello")
Test()
import "C"
var onClose = func() {}
//export SetCallback
func SetCallback(c ??????) {
println("set callback")
onClose = c // ?????
}
Какой тип у аргумента?
(type alias) CLLBKTYPE: Type[_FuncPointer]
И как его вызвать?