I was going by the example at the bottom of the OP. Use whatever type is
expected by the C API, of course.
> On Oct 31, 2016, at 4:41 PM, Florian Weimer wrote:
>
> * Pietro Gagliardi:
>
>> Just pass the null-terminated string and use C.int(len(goString)) as
>> the length. The length of a Go st
* Pietro Gagliardi:
> Just pass the null-terminated string and use C.int(len(goString)) as
> the length. The length of a Go string is already in bytes and does not
> include the terminating null (since Go has none), and I assume
> C.CString() produces the same byte sequence without encoding
> conv
C.CBytes does essentially this, but you either need to start with a []byte,
or the string conversion could be a second copy.
I don't see a need for a separate version CString without the null when you
can just pass the length-1. In the rare case that the extra byte makes a
difference, you coul
On 2016-10-31 15:39, Pietro Gagliardi wrote:
Just pass the null-terminated string and use C.int(len(goString)) as the length.
Yes... I mentioned that as a somewhat solution. ... it still allocates 1
byte more than needed.
/Peter
--
You received this message because you are subscribed to t
Just pass the null-terminated string and use C.int(len(goString)) as the
length. The length of a Go string is already in bytes and does not include the
terminating null (since Go has none), and I assume C.CString() produces the
same byte sequence without encoding conversions.
> On Oct 31, 2016,