summaryrefslogtreecommitdiff
path: root/src/cmd/cgo/doc.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-04 15:17:36 -0800
committerRuss Cox <rsc@golang.org>2009-11-04 15:17:36 -0800
commit33e0a3496b36d6a92c1e54bec50edeeef7c37d67 (patch)
tree2cd62a1f306a455adc0eb30a1eae4f2d94849fe8 /src/cmd/cgo/doc.go
parent3805f428cb2363dfe69d37ef00e4670b11334ceb (diff)
downloadgolang-33e0a3496b36d6a92c1e54bec50edeeef7c37d67.tar.gz
doc doc doc
R=r http://go/go-review/1016039
Diffstat (limited to 'src/cmd/cgo/doc.go')
-rw-r--r--src/cmd/cgo/doc.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go
new file mode 100644
index 000000000..022a87c15
--- /dev/null
+++ b/src/cmd/cgo/doc.go
@@ -0,0 +1,35 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+
+Cgo enables the creation of Go packages that call C code.
+
+Usage: cgo [compiler options] file.go
+
+The compiler options are passed through uninterpreted when
+invoking gcc to compile the C parts of the package.
+
+The input file.go is a syntactically valid Go source file that imports
+the pseudo-package "C" and then refers to types such as C.size_t,
+variables such as C.stdout, or functions such as C.putchar.
+
+If the import of "C" is immediately preceded by a comment, that
+comment is used as a header when compiling the C parts of
+the package. For example:
+
+ // #include <stdio.h>
+ // #include <errno.h>
+ import "C"
+
+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.
+
+The standard package makefile rules in Make.pkg automate the
+process of using cgo. See $GOROOT/misc/cgo/stdio and
+$GOROOT/misc/cgo/gmp for examples.
+
+Cgo does not yet work with gccgo.
+*/
+package documentation