toCStringList

fun List<String>.toCStringList(scope: <Error class: unknown class>, nullTerminate: Boolean = true): <Error class: unknown class><<Error class: unknown class><<Error class: unknown class><<Error class: unknown class>>>>

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

The Kotlin List of String to convert.

Return

A pointer to the array of C strings (char**), null-terminated if nullTerminate is true.

Parameters

scope

The AutofreeScope used to allocate memory for the native array and its elements.

nullTerminate

Whether to append a null pointer at the end of the array. Defaults to true.