summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/cgo/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/cgo/doc.go')
-rw-r--r--libgo/go/cmd/cgo/doc.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgo/go/cmd/cgo/doc.go b/libgo/go/cmd/cgo/doc.go
index d3a7b6d2a73..85441e61c04 100644
--- a/libgo/go/cmd/cgo/doc.go
+++ b/libgo/go/cmd/cgo/doc.go
@@ -53,6 +53,8 @@ For example:
// #include <png.h>
import "C"
+The default pkg-config tool may be changed by setting the PKG_CONFIG environment variable.
+
When building, the CGO_CFLAGS, CGO_CPPFLAGS, CGO_CXXFLAGS, CGO_FFLAGS and
CGO_LDFLAGS environment variables are added to the flags derived from
these directives. Package-specific flags should be set using the
@@ -214,6 +216,13 @@ by making copies of the data. In pseudo-Go definitions:
// C data with explicit length to Go []byte
func C.GoBytes(unsafe.Pointer, C.int) []byte
+As a special case, C.malloc does not call the C library malloc directly
+but instead calls a Go helper function that wraps the C library malloc
+but guarantees never to return nil. If C's malloc indicates out of memory,
+the helper function crashes the program, like when Go itself runs out
+of memory. Because C.malloc cannot fail, it has no two-result form
+that returns errno.
+
C references to Go
Go functions can be exported for use by C code in the following way:
@@ -317,6 +326,9 @@ The following options are available when running cgo directly:
Write out input file in Go syntax replacing C package
names with real values. Used to generate files in the
syscall package when bootstrapping a new target.
+ -srcdir directory
+ Find the Go input files, listed on the command line,
+ in directory.
-objdir directory
Put all generated files in directory.
-importpath string