c.h
typedef void* MVar;
C_FUNC(
MVar* myvar //[out], return value
)
test.go
var cvar unsafe.Pointer
_ = C.C_FUNC(&cvar)
当我运行test.go时,它会告诉我
cannot use _cgo5 (type *unsafe.Pointer) as type *_Ctype_MVar
in argument to _Cfunc_C_FUNC
在本文档Command cgo: Go references to C中,它说“ C类型void *由Go的unsafe.Pointer表示。”
cannot use _cgo5 (type *unsafe.Pointer) as type *_Ctype_MVar in argument to _Cfunc_C_FUNC