Hello,

The section on passing pointer to C in the cgo documentation is quite clear 
that letting C hold pointer to Go memory is not allowed.  I'd like to 
better understand the limitation.  Frankly, because of the architecture of 
a system I'm working on, the inability to transport pointers is 
complicating matters.

1) The Go objects in question are certainly on the heap.
2) The references in C are not needed to maintain the lifetime of the Go 
objects.

My understanding is that the main reason for the restriction is that Go 
might move to a moving garbage collector.  At the moment, unless there is 
definite work on this, I'm inclined to break the rule and let the C code 
hold onto pointers to Go memory.  However, before committing to this 
approach, I'd like to make sure I haven't missed any other reasons for the 
prohibition.

Thanks.

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/151b1597-ad8b-4867-8542-e204599ead2e%40googlegroups.com.

Reply via email to