xlab / c-for-go

Automatic C-Go Bindings Generator for Go Programming Language
https://c.for-go.com
MIT License
1.5k stars 119 forks source link

THIS IS NOT AN ISSUE!!! #159

Open huxulm opened 10 months ago

huxulm commented 10 months ago

Hello,thanks for providing this great tools! Can you provide any suggestion my problem?

Description:

In my header file:

int mylibFunc_2(int x[2][3]);

converted go code:

func MylibFunc2(X [][3]int32) int32 {
        // (*[3]_Ctype_int, *cgoAllocMap)
    cX, cXAllocMap := copyPIntArr3Bytes((*sliceHeader)(unsafe.Pointer(&X)))
    __ret := C.mylibFunc_2(cX)
    runtime.KeepAlive(cXAllocMap)
    __v := (int32)(__ret)
    return __v
}

copyPIntArr3Bytes is provide by my self because I didn't known how to config yaml to auto support this feature.