]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: static variables in the preamble may not be referenced
authorIan Lance Taylor <iant@golang.org>
Thu, 18 Jun 2015 01:03:16 +0000 (18:03 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 19 Jun 2015 01:08:43 +0000 (01:08 +0000)
This is a documentation fix that reflects the current reality.

Fixes #9673.

Change-Id: Ie436b277dfd1b68b13c67813d29c238d2c23b820
Reviewed-on: https://go-review.googlesource.com/11221
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/cgo/doc.go

index 96304603913cfea8e249f805f6c91b136008e92c..6ac0381f5a3745d9b779b94ce93c708253205f27 100644 (file)
@@ -20,6 +20,13 @@ the C parts of the package.  For example:
        // #include <errno.h>
        import "C"
 
+The preamble may contain any C code, including function and variable
+declarations and definitions.  These may then be referred to from Go
+code as though they were defined in the package "C".  All names
+declared in the preamble may be used, even if they start with a
+lower-case letter.  Exception: static variables in the preamble may
+not be referenced from Go code; static functions are permitted.
+
 See $GOROOT/misc/cgo/stdio and $GOROOT/misc/cgo/gmp for examples.  See
 "C? Go? Cgo!" for an introduction to using cgo:
 http://golang.org/doc/articles/c_go_cgo.html.