Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge functions will not work in the future #29

Closed
drewwells opened this issue Oct 1, 2015 · 1 comment
Closed

Bridge functions will not work in the future #29

drewwells opened this issue Oct 1, 2015 · 1 comment
Labels

Comments

@drewwells
Copy link
Member

https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md#support

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.

@drewwells drewwells added the bug label Oct 1, 2015
drewwells added a commit that referenced this issue Dec 20, 2015
changes for go pointer restrictions in go16 #29
@drewwells
Copy link
Member Author

fixed by 0e51a49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant