1
0
mirror of https://github.com/golang/go synced 2024-11-24 19:00:13 -07:00
go/misc/cgo/testcarchive
Ian Lance Taylor e45aebd6dd cmd/go: install headers for c-archive/c-shared cgo exports
When
  using -buildmode=c-archive or c-shared, and
  when installing packages that use cgo, and
  when those packages export some functions via //export comments,
then
  for each such package, install a pkg.h header file that declares the
  functions.

This permits C code to #include the header when calling the Go
functions.

This is a little awkward to use when there are multiple packages that
export functions, as you have to "go install" your c-archive/c-shared
object and then pull it out of the package directory.  When compiling
your C code you have to -I pkg/$GOOS_$GOARCH.  I haven't thought of
any more convenient approach.  It's simpler when only the main package
has exported functions.

When using c-shared you currently have to use a _shared suffix in the
-I option; it would be nice to fix that somehow.

Change-Id: I5d8cf08914b7d3c2b194120c77791d2732ffd26e
Reviewed-on: https://go-review.googlesource.com/9798
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-07 17:39:56 +00:00
..
src misc/cgo/testcarchive: enable test on darwin/arm 2015-04-20 15:16:16 +00:00
main.c cmd/go: install headers for c-archive/c-shared cgo exports 2015-05-07 17:39:56 +00:00
test.bash cmd/go: install headers for c-archive/c-shared cgo exports 2015-05-07 17:39:56 +00:00