]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: document //export preamble restriction
authorRuss Cox <rsc@golang.org>
Fri, 1 Feb 2013 16:33:52 +0000 (08:33 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 1 Feb 2013 16:33:52 +0000 (08:33 -0800)
Fixes #3497.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7235075

src/cmd/cgo/doc.go

index 6f3343de54ddab28216b8a2994abb8a859aabf4b..261883210118910b9f156fe730561d9dee2c5023 100644 (file)
@@ -116,6 +116,11 @@ copied from the cgo input files. Functions with multiple
 return values are mapped to functions returning a struct.
 Not all Go types can be mapped to C types in a useful way.
 
+Using //export in a file places a restriction on the preamble:
+since it is copied into two different C output files, it must not
+contain any definitions, only declarations. Definitions must be
+placed in preambles in other files, or in C source files.
+
 Cgo transforms the input file into four output files: two Go source
 files, a C file for 6c (or 8c or 5c), and a C file for gcc.