File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,16 @@ import (
61
61
// }
62
62
//
63
63
// Some C functions accept a void* argument that points to an arbitrary
64
- // data value supplied by the caller. It is not safe to coerce a [cgo. Handle]
64
+ // data value supplied by the caller. It is not safe to coerce a Handle
65
65
// (an integer) to a Go [unsafe.Pointer], but instead we can pass the address
66
66
// of the cgo.Handle to the void* parameter, as in this variant of the
67
- // previous example:
67
+ // previous example.
68
+ //
69
+ // Note that, as described in the [cmd/cgo] documentation,
70
+ // the C code must not keep a copy of the Go pointer that it receives,
71
+ // unless the memory is explicitly pinned using [runtime.Pinner].
72
+ // This example is OK because the C function myprint does not keep
73
+ // a copy of the pointer.
68
74
//
69
75
// package main
70
76
//
You can’t perform that action at this time.
0 commit comments