Closed
Description
We need some way to prevent Go pointers from crossing the boundary into C. People write code like (calling a C function that takes a T* to fill in). var x C.T C.f(&x) One option is to disallow this - a Go pointer &x is being passed to C. Another option is to have cgo's wrapper for C.f do a shallow copy into an allocated C pointer, then run f, then copy the data back into the original Go data, then free the allocated C pointer, then return. If the second option handles 99% of the pointers being passed, then we probably should do it. On the other hand, the free might create a dangling pointer that could confuse people. At least it's a dangling pointer into the C heap and not the Go heap. :-)