...

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

Documentation: cmd/go/testdata/script

     1env 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
     8cc -c -o pkg/o.syso ext.c
     9go build main.go
    10
    11-- ext.c --
    12// +build ignore
    13
    14int f() { return 42; }
    15-- pkg/pkg.go --
    16package pkg
    17
    18// extern int f(void);
    19import "C"
    20
    21func init() {
    22	if v := C.f(); v != 42 {
    23		panic(v)
    24	}
    25}
    26-- main.go --
    27package main
    28
    29import _ "pkg"
    30
    31func main() {}

View as plain text