Re: [go-nuts] How to call a C `writev` styled library api via cgo without allocation and copying of the whole byte slice vector?

2021-03-15 Thread Ian Lance Taylor
On Sat, Mar 13, 2021 at 6:25 AM rmfr wrote: > > Say here is a C api like `ssize_t writev(const struct iovec *iov, int > iovcnt)` which the definition of iovec is like below: > > ``` > struct iovec { > uint8_t *Base; /* Base address. */ > uint64_t Len;/* Length. */ > }; > ``` > >

[go-nuts] How to call a C `writev` styled library api via cgo without allocation and copying of the whole byte slice vector?

2021-03-13 Thread rmfr
Say here is a C api like `ssize_t writev(const struct iovec *iov, int iovcnt)` which the definition of iovec is like below: ``` struct iovec { uint8_t *Base; /* Base address. */ uint64_t Len;/* Length. */ }; ``` For C api which like `ssize_t write(const void *buf, size_t nbyte)