You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A particular unsafe area is C code that wants to hold on to Go func and pointer values for future callbacks from C to Go. This works today but is not permitted by these rules. It is hard to detect. One safe approach is: Go code that wants to preserve funcs/pointers stores them into a map indexed by an int. Go code calls the C code, passing the int, which the C code may store freely. When the C code wants to call into Go, it passes the int to a Go function that looks in the map and makes the call. An explicit call is required to release the value from the map if it is no longer needed, but that was already true before.
The approach of passing pointers to strings is definitely not valid. Also exported methods can no longer accept Go types to C types. So those will all need to be changed too.
The text was updated successfully, but these errors were encountered:
https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md#support
The approach of passing pointers to strings is definitely not valid. Also exported methods can no longer accept Go types to C types. So those will all need to be changed too.
The text was updated successfully, but these errors were encountered: