diff options
author | Russ Cox <rsc@golang.org> | 2021-04-20 16:22:01 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2021-04-23 21:48:41 +0000 |
commit | a6d3dc40c40c8a93e6b8bd641104d7655eb5093b (patch) | |
tree | 114676825ad70dc5779e112989904d152805e8eb /misc | |
parent | 9cc3469106df94ad0d3c806bcfbddb7e5224d8b6 (diff) | |
download | go-a6d3dc40c40c8a93e6b8bd641104d7655eb5093b.tar.gz go-a6d3dc40c40c8a93e6b8bd641104d7655eb5093b.zip |
misc/cgo/testso, misc/cgo/testsovar: fix for Windows
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.
This fixes misc/cgo/testso and misc/cgo/testsovar on windows/arm64.
Change-Id: I516b6ccba2fe3a9ee2c01e710a71850c4df8522f
Reviewed-on: https://go-review.googlesource.com/c/go/+/312046
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/testso/so_test.go | 4 | ||||
-rw-r--r-- | misc/cgo/testso/testdata/cgoso.go | 2 | ||||
-rw-r--r-- | misc/cgo/testsovar/so_test.go | 4 | ||||
-rw-r--r-- | misc/cgo/testsovar/testdata/cgoso.go | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/misc/cgo/testso/so_test.go b/misc/cgo/testso/so_test.go index 1c97ae9bcb..2023c51f11 100644 --- a/misc/cgo/testso/so_test.go +++ b/misc/cgo/testso/so_test.go @@ -79,6 +79,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/misc/cgo/testso/testdata/cgoso.go b/misc/cgo/testso/testdata/cgoso.go index bba5de3312..b59b2a8e8b 100644 --- a/misc/cgo/testso/testdata/cgoso.go +++ b/misc/cgo/testso/testdata/cgoso.go @@ -14,7 +14,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 void init(void); diff --git a/misc/cgo/testsovar/so_test.go b/misc/cgo/testsovar/so_test.go index 1c97ae9bcb..2023c51f11 100644 --- a/misc/cgo/testsovar/so_test.go +++ b/misc/cgo/testsovar/so_test.go @@ -79,6 +79,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/misc/cgo/testsovar/testdata/cgoso.go b/misc/cgo/testsovar/testdata/cgoso.go index 9c7f95e92e..d9deb556da 100644 --- a/misc/cgo/testsovar/testdata/cgoso.go +++ b/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" |