github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/src/cmd/go/testdata/script/cgo_syso_issue29253.txt (about)

     1  # This test tests that we can link in-package syso files that provides symbols
     2  # for cgo. See issue 29253.
     3  [!cgo] stop
     4  [!gc] stop
     5  cc -c -o pkg/o.syso ext.c
     6  go build main.go
     7  
     8  -- ext.c --
     9  // +build ignore
    10  
    11  int f() { return 42; }
    12  -- pkg/pkg.go --
    13  package pkg
    14  
    15  // extern int f(void);
    16  import "C"
    17  
    18  func init() {
    19  	if v := C.f(); v != 42 {
    20  		panic(v)
    21  	}
    22  }
    23  -- main.go --
    24  package main
    25  
    26  import _ "pkg"
    27  
    28  func main() {}