Hello everyone,
I'm experimenting with extension for sqlite written in Go. This is simple function exported to shared library, which produces string from recived arguments. If such function returns value (which is result of concatenation of strings that were created in C code) as GO string, program starts panicking with message 'cgo result has Go pointer'. When I return C string instead Go string everything works as expected. Also I noticed, that when program calls other exported function, which returns value that is known on compile time, it doesn't crash.
I'm curious what is difference between first case, when function returns concatenation of arguments passed from C code and program starts panicking and second one when function returns 'constant' expression? Does it mean, that constant string expression, known on compile time doesn't contain Go pointer and doesn't apply to CGO rules
https://golang.org/cmd/cgo/#hdr-Passing_pointers?
Kind reagards,
Milosz