mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
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>
This commit is contained in:
parent
9cc3469106
commit
a6d3dc40c4
|
@ -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"
|
||||
}
|
||||
|
|
2
misc/cgo/testso/testdata/cgoso.go
vendored
2
misc/cgo/testso/testdata/cgoso.go
vendored
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
2
misc/cgo/testsovar/testdata/cgoso.go
vendored
2
misc/cgo/testsovar/testdata/cgoso.go
vendored
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue