mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +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
4 changed files with 10 additions and 2 deletions
|
|
@ -79,6 +79,10 @@ func TestSO(t *testing.T) {
|
||||||
case "windows":
|
case "windows":
|
||||||
ext = "dll"
|
ext = "dll"
|
||||||
args = append(args, "-DEXPORT_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":
|
case "aix":
|
||||||
ext = "so.1"
|
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 solaris LDFLAGS: -L. -lcgosotest
|
||||||
#cgo netbsd LDFLAGS: -L. libcgosotest.so
|
#cgo netbsd LDFLAGS: -L. libcgosotest.so
|
||||||
#cgo darwin LDFLAGS: -L. libcgosotest.dylib
|
#cgo darwin LDFLAGS: -L. libcgosotest.dylib
|
||||||
#cgo windows LDFLAGS: -L. libcgosotest.dll
|
#cgo windows LDFLAGS: -L. libcgosotest.a
|
||||||
#cgo aix LDFLAGS: -L. -l cgosotest
|
#cgo aix LDFLAGS: -L. -l cgosotest
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,10 @@ func TestSO(t *testing.T) {
|
||||||
case "windows":
|
case "windows":
|
||||||
ext = "dll"
|
ext = "dll"
|
||||||
args = append(args, "-DEXPORT_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":
|
case "aix":
|
||||||
ext = "so.1"
|
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 solaris LDFLAGS: -L. -lcgosotest
|
||||||
#cgo netbsd LDFLAGS: -L. libcgosotest.so
|
#cgo netbsd LDFLAGS: -L. libcgosotest.so
|
||||||
#cgo darwin LDFLAGS: -L. libcgosotest.dylib
|
#cgo darwin LDFLAGS: -L. libcgosotest.dylib
|
||||||
#cgo windows LDFLAGS: -L. libcgosotest.dll
|
#cgo windows LDFLAGS: -L. libcgosotest.a
|
||||||
#cgo aix LDFLAGS: -L. -l cgosotest
|
#cgo aix LDFLAGS: -L. -l cgosotest
|
||||||
|
|
||||||
#include "cgoso_c.h"
|
#include "cgoso_c.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue