go-mpi icon indicating copy to clipboard operation
go-mpi copied to clipboard

MPI.Init failing with panic

Open rossmeier opened this issue 9 years ago • 1 comments

panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 1 [running]: panic(0x4f0780, 0xc82000a360) /usr/lib/go/src/runtime/panic.go:481 +0x3e6 github.com/JohannWeging/go-mpi.Init(0x7a4560, 0x0) .../src/github.com/JohannWeging/go-mpi/init.go:41 +0x2c1 main.main() .../main.go:16 +0x111

Go 1.6.2 on 64 bit machine with openmpi err := C.MPI_Init(&c_argc, (***C.char)(unsafe.Pointer(&c_argv))) I'm not familliar with that api, but probably you want to have a **C.char and therefore leave the & before the c_argv

rossmeier avatar Jun 05 '16 19:06 rossmeier

Go 1.6 changes the rules for go pointers in c code. You can disable the check with the environment variable GODEBUG=cgocheck=0

See https://golang.org/doc/go1.6#cgo for details

kinnarr avatar Jan 02 '17 14:01 kinnarr