martmists
10/10/2021, 9:03 PMCPointer<ByteVar>
? I only see .cstr
documented but that turns it into a CValues<ByteVar>
mbonnin
10/10/2021, 9:16 PMCPointer
is for something that lives on the heap (has reference semantics) while CValues
has value semantics (might be a const string or something else, not sure)mbonnin
10/10/2021, 9:18 PMCPointer
and memcpy to it though:
val src = "Hello".cstr
val dst = allocArray<ByteVar>(src.size)
memcpy(dst, src, src.size.convert())
(don't take this as gospel, it might very well be wrong about size, terminating zero and all that kind of thingies)Dominaezzz
10/10/2021, 10:13 PMmemScoped { yourFunction("The string".cstr.ptr) }
. Haven't done native in a while but this is a shortcut iirc.martmists
10/10/2021, 11:10 PMDominaezzz
10/11/2021, 6:26 AMmartmists
10/11/2021, 10:14 AMDominaezzz
10/11/2021, 10:31 AM