From: Ian Lance Taylor Date: Thu, 18 Jun 2015 01:03:16 +0000 (-0700) Subject: cmd/cgo: static variables in the preamble may not be referenced X-Git-Tag: go1.5beta1~177 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1a040c923035fbab613ef9f37422e91ac01ff911;p=gostls13.git cmd/cgo: static variables in the preamble may not be referenced 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 --- diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 9630460391..6ac0381f5a 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -20,6 +20,13 @@ the C parts of the package. For example: // #include 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.