Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(115)

Delta Between Two Patch Sets: src/cmd/cgo/doc.go

Issue 4550084: code review 4550084: cgo: support pkg-config for flags and libs (Closed)
Left Patch Set: diff -r 96fb12b2040e https://go.googlecode.com/hg/ Created 13 years, 10 months ago
Right Patch Set: diff -r 6f3b1a30a344 https://go.googlecode.com/hg/ Created 13 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/cmd/cgo/gcc.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 /* 5 /*
6 6
7 Cgo enables the creation of Go packages that call C code. 7 Cgo enables the creation of Go packages that call C code.
8 8
9 Usage: cgo [compiler options] file.go 9 Usage: cgo [compiler options] file.go
10 10
(...skipping 18 matching lines...) Expand all
29 by $GOOS, $GOARCH, or $GOOS/$GOARCH are only defined in matching 29 by $GOOS, $GOARCH, or $GOOS/$GOARCH are only defined in matching
30 systems. For example: 30 systems. For example:
31 31
32 // #cgo CFLAGS: -DPNG_DEBUG=1 32 // #cgo CFLAGS: -DPNG_DEBUG=1
33 // #cgo linux CFLAGS: -DLINUX=1 33 // #cgo linux CFLAGS: -DLINUX=1
34 // #cgo LDFLAGS: -lpng 34 // #cgo LDFLAGS: -lpng
35 // #include <png.h> 35 // #include <png.h>
36 import "C" 36 import "C"
37 37
38 Alternatively, CFLAGS and LDFLAGS may be obtained via the pkg-config 38 Alternatively, CFLAGS and LDFLAGS may be obtained via the pkg-config
39 tool using a #cgo directive with the package names: 39 tool using a '#cgo pkg-config:' directive followed by the package names.
adg 2011/05/26 22:43:02 tool using a '#cgo pkg-config:' directive followed
40 For example:
40 41
41 // #cgo pkg-config: png cairo 42 // #cgo pkg-config: png cairo
42 // #include <png.h> 43 // #include <png.h>
43 import "C" 44 import "C"
44 45
45 Within the Go file, C identifiers or field names that are keywords in Go 46 Within the Go file, C identifiers or field names that are keywords in Go
46 can be accessed by prefixing them with an underscore: if x points at a C 47 can be accessed by prefixing them with an underscore: if x points at a C
47 struct with a field named "type", x._type accesses the field. 48 struct with a field named "type", x._type accesses the field.
48 49
49 The standard C numeric types are available under the names 50 The standard C numeric types are available under the names
(...skipping 20 matching lines...) Expand all
70 Cgo transforms the input file into four output files: two Go source 71 Cgo transforms the input file into four output files: two Go source
71 files, a C file for 6c (or 8c or 5c), and a C file for gcc. 72 files, a C file for 6c (or 8c or 5c), and a C file for gcc.
72 73
73 The standard package makefile rules in Make.pkg automate the 74 The standard package makefile rules in Make.pkg automate the
74 process of using cgo. See $GOROOT/misc/cgo/stdio and 75 process of using cgo. See $GOROOT/misc/cgo/stdio and
75 $GOROOT/misc/cgo/gmp for examples. 76 $GOROOT/misc/cgo/gmp for examples.
76 77
77 Cgo does not yet work with gccgo. 78 Cgo does not yet work with gccgo.
78 */ 79 */
79 package documentation 80 package documentation
LEFTRIGHT
« no previous file | src/cmd/cgo/gcc.go » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b