]> Cypherpunks repositories - gostls13.git/commitdiff
doc: clarify duplicate symbol condition in cgo
authorAndrey Petrov <andrey.petrov@shazow.net>
Thu, 18 Jun 2015 19:43:01 +0000 (21:43 +0200)
committerIan Lance Taylor <iant@golang.org>
Fri, 19 Jun 2015 00:48:42 +0000 (00:48 +0000)
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>
src/cmd/cgo/doc.go

index 1a2595b76643aa3ab3c6f67d72d885021cedd977..96304603913cfea8e249f805f6c91b136008e92c 100644 (file)
@@ -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