Text file src/cmd/go/testdata/script/cgo_syso_issue29253.txt

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

View as plain text