For a non-struct slice in Go
a := []byte{0,1,2,3,4,5,6,7}
And pass to C via unsafe.Pointer()
C.some_method((*C.char)(unsafe.Pointer(&a[0])), C.int(len(a)))
Is it safe to write anything into this pointer with caution on it's length?
void some_method(char* a, int a_len) {
for (int i=0; i<a_len; i++) {
a[i] = i+1;
}
}