2
I’m trying to create a Shared library in go, but the return (*C.char) always comes back empty:
How to do to return right?
package main
import (
"C"
"fmt"
)
//export Upper
func Upper(palavra *C.char, retorno *C.char, size *int) int {
fmt.Println(C.GoString(palavra))
retorno = C.CString(strings.ToUpper(str1))
*size = int(len(palavra))
return 0
}
func main() {}
Shouldn’t be
**C.char
and then do:*retorno = C.CString(strings.ToUpper(str1))
?– Inkeliz
Inkeliz, I tested as you suggested, but even though now I get a return, the return is coming wrong(dirty). I also tried to leave
*C.char
and putting*retorno = *C.CString(strings.ToUpper(str1))
... but in this way only changes the first position.– João Bueno