1 # Test that syso in deps is available to cgo.
2
3 [!compiler:gc] skip 'requires syso support'
4 [!cgo] skip
5 [short] skip 'invokes system C compiler'
6
7 # External linking is not supported on linux/ppc64.
8 # See: https://github.com/golang/go/issues/8912
9 [GOOS:linux] [GOARCH:ppc64] skip
10
11 cc -c -o syso/x.syso syso/x.c
12 cc -c -o syso2/x.syso syso2/x.c
13 go build m/cgo
14
15 -- go.mod --
16 module m
17
18 go 1.18
19 -- cgo/x.go --
20 package cgo
21
22 // extern void f(void);
23 // extern void g(void);
24 import "C"
25
26 func F() {
27 C.f()
28 }
29
30 func G() {
31 C.g()
32 }
33
34 -- cgo/x2.go --
35 package cgo
36
37 import _ "m/syso"
38
39 -- syso/x.c --
40 //go:build ignore
41
42 void f() {}
43
44 -- syso/x.go --
45 package syso
46
47 import _ "m/syso2"
48
49 -- syso2/x.c --
50 //go:build ignore
51
52 void g() {}
53
54 -- syso2/x.go --
55 package syso2
56
View as plain text