Thank you Bryan for your advice. In examples, I see how to pass the Go pointers directly.
For example : h := C.CString(name) defer C.free(unsafe.Pointer(h)) gerrno, err := C.getaddrinfo(h, nil, &hints, &res) To h := make([]byte, len(name)+1) copy(h, name) gerrno, err := C.getaddrinfo((*C.char)(unsafe.Pointer(&h[0])), nil, &hints, &res) But I found nothing on how to append an extra 0 to the slice. -- 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.