mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: document //export preamble restriction
Fixes #3497. R=golang-dev, iant CC=golang-dev https://golang.org/cl/7235075
This commit is contained in:
parent
25d1fc9389
commit
ed9fc7531d
1 changed files with 5 additions and 0 deletions
|
|
@ -116,6 +116,11 @@ copied from the cgo input files. Functions with multiple
|
||||||
return values are mapped to functions returning a struct.
|
return values are mapped to functions returning a struct.
|
||||||
Not all Go types can be mapped to C types in a useful way.
|
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
|
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.
|
files, a C file for 6c (or 8c or 5c), and a C file for gcc.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue