From d59c88786dc3a27876c782e2639ade5feae520fc Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Mon, 30 Jan 2012 16:04:45 -0200 Subject: [PATCH] cmd/go: fix including of _cgo_export.h 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 8a895b41e28..659e5fce97a 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -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"}