]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix including of _cgo_export.h
authorGustavo Niemeyer <gustavo@niemeyer.net>
Mon, 30 Jan 2012 18:04:45 +0000 (16:04 -0200)
committerGustavo Niemeyer <gustavo@niemeyer.net>
Mon, 30 Jan 2012 18:04:45 +0000 (16:04 -0200)
This will add the temporary object directory into the lookup
path so that cgo-exported function declarations may be
included from C files.

R=golang-dev, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/5600043

src/cmd/go/build.go

index 8a895b41e28a265692918af4851913b790a67045..659e5fce97a378f8d2460b7a1acc0ab7418b513a 100644 (file)
@@ -1146,6 +1146,9 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
                }
        }
 
+       // Allows including _cgo_export.h from .[ch] files in the package.
+       cgoCFLAGS = append(cgoCFLAGS, "-I", obj)
+
        // cgo
        // TODO: CGOPKGPATH, CGO_FLAGS?
        gofiles := []string{obj + "_cgo_gotypes.go"}