cgo

/*
typedef struct SA{
int a;
const char *s;
}SA;


int Init(struct SA* s){
s->a = 9;
s->s = "okkasjdf";
return 1;
}

int Final(struct SA* s){
return 2;
}
*/
import "C"
import "fmt"

type A struct {
a C.SA
d int
}

func main() {
a := new(A)
r := C.Init(&a.a)
rd := C.int(21)
if (r != rd){
fmt.Println("err1")
}
rd = C.Final(&a.a)
}
posted @ 2020-12-09 17:01  zJanly  阅读(132)  评论(0编辑  收藏  举报