• Ian Lance Taylor's avatar
    cmd/go: install headers for c-archive/c-shared cgo exports · e45aebd6
    Ian Lance Taylor authored
    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/9798Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    e45aebd6
test.bash 1.32 KB