-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Milestone
Description
Hello, any Go developers interested in working with Zig developers on this use case?
Upstream issue: ziglang/zig#7874
Tested with go 1.15.5.
main.go
package main
//int Add(int a, int b){
// return a+b;
//}
import "C"
import "fmt"
func main() {
a := C.int(10)
b := C.int(20)
c := C.Add(a, b)
fmt.Println(c) // 30
}
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC="zcc" CXX="zc++" go build main.go
zcc
#!/bin/sh
zig cc -target x86_64-windows-gnu $@
zc++
#!/bin/sh
zig c++ -target x86_64-windows-gnu $@
output:
# command-line-arguments
warning: unsupported linker arg: --compress-debug-sections=zlib-gnu
It produces main.exe
but when run it segfaults in runtime.rt0_go()
(called from main()). Expected output is to print "30" to the console when run in cmd.exe.
Happy to chat on IRC or Discord if anyone has some ideas to try.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted