restrictions for go1.6 were announced about what the final verdict was
regarding passing functions pointers to C, so they may be used as a
callback in an event-driven system. For example, I understand that GUI
toolkits like GTK require many callbacks to be set for handling to user
Is it possible for these systems to be integrated in Go? When is it
acceptable to pass a function pointer to C, and for C to store that pointer
for future use?
Naively it seems intuitive to me that passing closures can trivialaly
violate the pointer passing restrictions (by closing over variables
pointing to Go memory). But if I have exported a static function from Go
(exported to C using `//export myFunc`). Then can I pass that a pointer to
the exported function to cgo? A slight variant of this question would be,
can I pass a pointer to a C function which calls a static Go function that
was exported by my application?
Of course C is not supposed to store Go pointers according to the new
restrictions, so really it is just unclear to me when pointers to static
functions are actually "Go pointers" (using the specific terminology of the
cgo specification, pointers pointing to memory allocated/managed by the Go
I would really appreciate it if anyone could help shed light on this for
me. Thanks for the help.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.