aboutsummaryrefslogtreecommitdiffhomepage
path: root/loader/loader.go
diff options
context:
space:
mode:
Diffstat (limited to 'loader/loader.go')
-rw-r--r--loader/loader.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/loader/loader.go b/loader/loader.go
index a201b1526..3991fdcf5 100644
--- a/loader/loader.go
+++ b/loader/loader.go
@@ -72,6 +72,7 @@ type Package struct {
Files []*ast.File
FileHashes map[string][]byte
CFlags []string // CFlags used during CGo preprocessing (only set if CGo is used)
+ CGoHeaders []string // text above 'import "C"' lines
Pkg *types.Package
info types.Info
}
@@ -397,8 +398,9 @@ func (p *Package) parseFiles() ([]*ast.File, error) {
if p.program.clangHeaders != "" {
initialCFlags = append(initialCFlags, "-Xclang", "-internal-isystem", "-Xclang", p.program.clangHeaders)
}
- generated, cflags, ldflags, accessedFiles, errs := cgo.Process(files, p.program.workingDir, p.program.fset, initialCFlags)
+ generated, headerCode, cflags, ldflags, accessedFiles, errs := cgo.Process(files, p.program.workingDir, p.program.fset, initialCFlags)
p.CFlags = append(initialCFlags, cflags...)
+ p.CGoHeaders = headerCode
for path, hash := range accessedFiles {
p.FileHashes[path] = hash
}