djimenez / iconv-go

iconv support for Go
BSD 2-Clause "Simplified" License
418 stars 66 forks source link

Go 1.6 Panic: cgo argument has Go pointer to Go pointer #23

Closed kowalczykp closed 8 years ago

kowalczykp commented 8 years ago

Go 1.6 is more restrict about passing pointers to cgo. golang/go#12416

Passing a pointer to go pointer causes the following panic in iconv-go:

runtime.errorString: runtime error: cgo argument has Go pointer to Go pointer File "runtime/panic.go", line 426, in gopanic reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz)) File "runtime/cgocall.go", line 499, in cgoCheckArg panic(errorString(msg)) File "runtime/cgocall.go", line 373, in cgoCheckPointer cgoCheckArg(pt.elem, p, true, false, cgoCheckPointerFail) File "github.com/djimenez/iconv-go/converter.go", line 83, in Convert _, err = C.iconv(this.context, &inputPointer, &inputLeft, &outputPointer, &outputLeft) File "github.com/djimenez/iconv-go/converter.go", line 123, in ConvertString bytesRead, bytesWritten, err = this.Convert(inputBuffer[totalBytesRead:], outputBuffer[totalBytesWritten:])

kowalczykp commented 8 years ago

@djimenez Any chance for having a look at this?

Regards Pawel