1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:04:49 -07:00
go/misc/cgo
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
..
errors build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
gmp misc/cgo/gmp: fix typo. 2013-03-30 19:02:14 +08:00
life misc/cgo: prepare for 64-bit ints 2012-09-24 14:58:45 -04:00
nocgo cmd/ld: really import runtime/cgo for external link 2014-05-20 21:36:50 -07:00
stdio misc/cgo/stdio: make it work on Windows and also test it 2012-09-20 00:27:23 +08:00
test misc/cgo: add various solaris build lines 2015-05-06 11:38:08 +00:00
testasan runtime: more flexible heap memory mapping on 64-bits 2013-06-12 18:47:16 +04:00
testcarchive cmd/go: install headers for c-archive/c-shared cgo exports 2015-05-07 17:39:56 +00:00
testcshared cmd/go: install headers for c-archive/c-shared cgo exports 2015-05-07 17:39:56 +00:00
testgodefs build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
testshared cmd/go: rebuild stale shared objects before linking against them. 2015-05-05 22:08:25 +00:00
testsigfwd runtime: signal forwarding 2015-04-24 05:19:39 +00:00
testso misc/cgo: add various solaris build lines 2015-05-06 11:38:08 +00:00
testtls misc/cgo/testtls: make test less flaky 2014-01-21 19:44:51 -05:00