Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CStringArray ¶
CStringArray You can write as this directly.
// []string -> [](*C.char)
var strs []string
cCharArray := make([]*C.char, 0, len(strs))
for _, s := range strs {
char := (*C.char)(unsafe.Pointer(C.CString(s)))
cCharArray = append(cCharArray, char)
defer C.free(unsafe.Pointer(char)) //释放内存
}
var cstr **C.char
var cstrSize C.int
cstr = (**C.char)(unsafe.Pointer(&cCharArray[0]))
cstrSize = C.int(len(strs))
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.