mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cgo: various bug fixes
* remember #defined names, so that C.stdout can refer
to the real name (on OS X) __stdoutp.
* better handling of #defined constant expressions
* allow n, err = C.strtol("asdf", 0, 123) to get errno as os.Error
* write all output files to current directory
* don't require gcc output if there was no input
Fixes #533.
Fixes #709.
Fixes #756.
R=r
CC=dho, golang-dev, iant
https://golang.org/cl/1734047
This commit is contained in:
parent
e8fcf60093
commit
0432f289f7
13 changed files with 1321 additions and 732 deletions
|
|
@ -23,6 +23,19 @@ the package. For example:
|
|||
// #include <errno.h>
|
||||
import "C"
|
||||
|
||||
C identifiers or field names that are keywords in Go can be
|
||||
accessed by prefixing them with an underscore: if x points at
|
||||
a C struct with a field named "type", x._type accesses the field.
|
||||
|
||||
To access a struct, union, or enum type directly, prefix it with
|
||||
struct_, union_, or enum_, as in C.struct_stat.
|
||||
|
||||
Any C function that returns a value may be called in a multiple
|
||||
assignment context to retrieve both the return value and the
|
||||
C errno variable as an os.Error. For example:
|
||||
|
||||
n, err := C.atoi("abc")
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue