mirror of
https://github.com/golang/go
synced 2024-11-11 23:40:22 -07:00
doc: clarify duplicate symbol condition in cgo
Spell out what will happen if a declaration and definition is included in the same file, should help people who run into duplicate symbol errors and search for relevant keywords. This edit is based on opening issue #11263 erroneously. Change-Id: I0645a9433b8668d2ede9b9a3f6550d802c26388b Reviewed-on: https://go-review.googlesource.com/11247 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
2f3d103f55
commit
9f3a2d5f9a
@ -207,8 +207,10 @@ 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.
|
||||
contain any definitions, only declarations. If a file contains both
|
||||
definitions and declarations, then the two output files will produce
|
||||
duplicate symbols and the linker will fail. To avoid this, definitions
|
||||
must be placed in preambles in other files, or in C source files.
|
||||
|
||||
Using cgo directly
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user