I'm having issues building a Windows DLL in Golang 1.10, which is supported in this latest version:
"The various build modes have been ported to more systems. Specifically, c-shared now works on linux/ppc64le, windows/386, and windows/amd64;" (Source: https://golang.org/doc/go1.10)
I have a very simple program right now (main.go
) that only exports one function "Test", but am having issues when using the following "go build" command: env GOOS=windows GOARCH=386 go build -buildmode=c-shared main.go
Specifically, receiving the can't load package: package main: build constraints exclude all Go files in [PATH]
error. The source code for main.go
is shown below:
package main
import (
"C"
"fmt"
)
func main() {
fmt.Println("from main")
}
//export Test
func Test() string {
return "this is a test"
}
I've never encountered this error before and building without specifying GOOS
and GOARCH
works. Hoping someone has encountered this issue and can help me out.