Hi I have this structure in C created by rsl libray typedef struct { Radar_header <file:///home/martin/Scaricati/rsl-v1.50/doc/RSL_radar_header_struct.html> h; Volume <file:///home/martin/Scaricati/rsl-v1.50/doc/RSL_volume_struct.html> **v; } Radar;
Using cgo i read the structure with Radar *readRad(char *fname) { return RSL_anyformat_to_radar(fname, NULL); } and call this function in go RPointer := C.readRad(C.CString(os.Args[1])) and i see the structure with fmt.Printf("%T",RPointer) => *main._Ctype_struct___0 with fmt.Printf("%+v",RPointer) => &{h:{} _:[0 0 0 0] *v:0xe59b60*} The field is a **C.Volume pointer. The question is: it's possible with Golang list all C.Volume's struct pointed ? like this for i := 0; i < int(RPointer.h.nvolumes); i++ { pv := *RPointer.v[i] fmt.Printf("\nVOLUME Sweep %+v\n", *pv.sweep) } the exit is type **C.struct___2 does not support indexing I tried with unsafe.Pointer using *puint1 := unsafe.Pointer(RPointer.v)* *sizep := unsafe.Sizeof(RPointer.v)fmt.Printf("\npuint [%+v] -> + sizeoff [%+v]\n", puint1, unsafe.Pointer(uintptr(puint1)+sizep))* and printf is puint [0xe59b60] -> + sizeoff [0xe59b68] there is a casting like this volume2 := (*C.Volume)(*unsafe.Pointer(uintptr(puint1) + sizep)) Thanks Alex -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.