C中的字符串是a
*C.char,而不是Go
string。让导出的函数接受正确的C类型,并根据需要在Go中进行转换:
//export GoFunctionfunc GoFunction(str *C.char) { fmt.Println("Hello from GoFunction!") fmt.Println(C.GoString(str))}
C中的字符串是a
*C.char,而不是Go
string。让导出的函数接受正确的C类型,并根据需要在Go中进行转换:
//export GoFunctionfunc GoFunction(str *C.char) { fmt.Println("Hello from GoFunction!") fmt.Println(C.GoString(str))}