blob: 4fb5ccab04e1813617bd8c6b0c5980f3a96c2843 [file] [log] [blame]
env GO111MODULE=off
[short] skip
# This test tests that we can link in-package syso files that provides symbols
# for cgo. See issue 29253.
[!cgo] stop
[!gc] stop
cc -c -o pkg/o.syso ext.c
go build main.go
-- ext.c --
// +build ignore
int f() { return 42; }
-- pkg/pkg.go --
package pkg
// extern int f(void);
import "C"
func init() {
if v := C.f(); v != 42 {
panic(v)
}
}
-- main.go --
package main
import _ "pkg"
func main() {}