Commit 0c9ea63b authored by Russ Cox's avatar Russ Cox

cgo: explain how to free something

R=golang-dev, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/4958053
parent 335da67e
...@@ -72,7 +72,10 @@ the pointer to the first element explicitly: C.f(&x[0]). ...@@ -72,7 +72,10 @@ the pointer to the first element explicitly: C.f(&x[0]).
A few special functions convert between Go and C types A few special functions convert between Go and C types
by making copies of the data. In pseudo-Go definitions: by making copies of the data. In pseudo-Go definitions:
// Go string to C string - result is not garbage collected // Go string to C string
// The C string is allocated in the C heap using malloc.
// It is the caller's responsibility to arrange for it to be
// freed, such as by calling C.free.
func C.CString(string) *C.char func C.CString(string) *C.char
// C string to Go string // C string to Go string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment