I have changed the go code into the below, but still got error. Something
else I missed?
gonameunits := []string{"gpu0", "gpu1", "gpu2", "gpu3"}
nameunits := make([]*C.char, len(gonameunits))
for i, _ := range gonameunits {
nameunits[i] = C.CString(gonameunits[i])
defer C.free(unsafe.Pointer(nameunits[i]))
}
fmt.Println("nameunits:", nameunits)
golevelmatrix := [3][3]int{{1, 0, 0}, {3, 3, 0}, {3, 3, 2}}
levelmatrix := make([][]C.int, len(golevelmatrix))
for i, _ := range golevelmatrix {
levelmatrix[i] = make([]C.int, len(golevelmatrix[i]))
for j, _ := range golevelmatrix[i] {
levelmatrix[i][j] = C.int(golevelmatrix[i][j])
}
}
fmt.Println("levelmatrix:", levelmatrix)
C.test_settopologyresource(mod, C.CString("node1"), C.int(2),
(**C.char)(unsafe.Pointer(&nameunits[0])),
(**C.int)(unsafe.Pointer(&levelmatrix[0][0])))
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.