mirror of
https://github.com/golang/go
synced 2024-11-21 21:54:40 -07:00
cgo: note that CString result must be freed
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/4968054
This commit is contained in:
parent
95429d82f1
commit
0cfa0fe242
@ -72,7 +72,7 @@ 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
|
// Go string to C string - result is not garbage collected
|
||||||
func C.CString(string) *C.char
|
func C.CString(string) *C.char
|
||||||
|
|
||||||
// C string to Go string
|
// C string to Go string
|
||||||
|
@ -18,7 +18,7 @@ x_cgo_malloc(void *p)
|
|||||||
|
|
||||||
void (*_cgo_malloc)(void*) = x_cgo_malloc;
|
void (*_cgo_malloc)(void*) = x_cgo_malloc;
|
||||||
|
|
||||||
/* Stub for calling from Go */
|
/* Stub for calling free from Go */
|
||||||
static void
|
static void
|
||||||
x_cgo_free(void *p)
|
x_cgo_free(void *p)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user