Does anyone know how to use a `CPointerVar`? I’ve ...
# kotlin-native
s
Does anyone know how to use a
CPointerVar
? I’ve been stuck on this for a few days. I’m interacting with the following c function:
Copy code
idevice_error_t idevice_get_device_list_extended(idevice_info_t **devices, int *count);
I’m calling it like this:
Copy code
val connectedDevices: CPointerVar<idevice_info_tVar> = alloc()
val connectedDevicesSize: IntVar = alloc()
idevice_get_device_list_extended(connectedDevices.ptr, connectedDevicesSize.ptr)
I have no idea to get the array of devices out of the
val connectedDevices
. There are no examples using
CPointerVar
and
CValues
that I’ve been able to find to figure this out. Any help would be much appreciated!
m
Copy code
val device: idevince_info_t = connectedDevices.value!!.get(0)
?
s
That works. Thank you so much!
👍 1