diff options
Diffstat (limited to 'libgo/misc/cgo/testsovar')
-rw-r--r-- | libgo/misc/cgo/testsovar/so_test.go | 10 | ||||
-rw-r--r-- | libgo/misc/cgo/testsovar/testdata/cgoso.go | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libgo/misc/cgo/testsovar/so_test.go b/libgo/misc/cgo/testsovar/so_test.go index 57f0fd34f78..6d14e32dc6c 100644 --- a/libgo/misc/cgo/testsovar/so_test.go +++ b/libgo/misc/cgo/testsovar/so_test.go @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build cgo // +build cgo package so_test import ( - "io/ioutil" "log" "os" "os/exec" @@ -37,7 +37,7 @@ func requireTestSOSupported(t *testing.T) { func TestSO(t *testing.T) { requireTestSOSupported(t) - GOPATH, err := ioutil.TempDir("", "cgosotest") + GOPATH, err := os.MkdirTemp("", "cgosotest") if err != nil { log.Fatal(err) } @@ -47,7 +47,7 @@ func TestSO(t *testing.T) { if err := overlayDir(modRoot, "testdata"); err != nil { log.Panic(err) } - if err := ioutil.WriteFile(filepath.Join(modRoot, "go.mod"), []byte("module cgosotest\n"), 0666); err != nil { + if err := os.WriteFile(filepath.Join(modRoot, "go.mod"), []byte("module cgosotest\n"), 0666); err != nil { log.Panic(err) } @@ -80,6 +80,10 @@ func TestSO(t *testing.T) { case "windows": ext = "dll" args = append(args, "-DEXPORT_DLL") + // At least in mingw-clang it is not permitted to just name a .dll + // on the command line. You must name the corresponding import + // library instead, even though the dll is used when the executable is run. + args = append(args, "-Wl,-out-implib,libcgosotest.a") case "aix": ext = "so.1" } diff --git a/libgo/misc/cgo/testsovar/testdata/cgoso.go b/libgo/misc/cgo/testsovar/testdata/cgoso.go index 9c7f95e92ea..d9deb556da8 100644 --- a/libgo/misc/cgo/testsovar/testdata/cgoso.go +++ b/libgo/misc/cgo/testsovar/testdata/cgoso.go @@ -18,7 +18,7 @@ package cgosotest #cgo solaris LDFLAGS: -L. -lcgosotest #cgo netbsd LDFLAGS: -L. libcgosotest.so #cgo darwin LDFLAGS: -L. libcgosotest.dylib -#cgo windows LDFLAGS: -L. libcgosotest.dll +#cgo windows LDFLAGS: -L. libcgosotest.a #cgo aix LDFLAGS: -L. -l cgosotest #include "cgoso_c.h" |