我在 Golang 1.10 中构建 Windows DLL 时遇到问题,此最新版本支持此功能:
main.goenv GOOS=windows GOARCH=386 go build -buildmode=c-shared main.go
can't load package: package main: build constraints exclude all Go files in [PATH]main.go
package main
import (
"C"
"fmt"
)
func main() {
fmt.Println("from main")
}
//export Test
func Test() string {
return "this is a test"
}
GOOSGOARCH