toCStringList
Converts a Kotlin List of String into its native C equivalent: an array of C strings (char**
).
This function uses the provided AutofreeScope to allocate the necessary memory for the C string array, ensuring that the memory is automatically managed and freed when the scope exits.
Each string in the List is converted to a C string (char*
) using UTF-8 encoding. If nullTerminate is true
(default), a null
pointer is appended to the array to indicate the end of the list. If nullTerminate is false
, the array will not be null-terminated.
Receiver
Return
A pointer to the array of C strings (char**
), null-terminated if nullTerminate is true
.
Parameters
The AutofreeScope used to allocate memory for the native array and its elements.
Whether to append a null
pointer at the end of the array. Defaults to true
.