https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
w

William Reed

03/24/2023, 1:42 PM
i have a c function that accepts something like
some_struct_t**
and the function populates the array at the given pointer. i’ve seen docs on how to create an array and get a pointer to it in K/N but since i don’t know the size of it ahead of time i’m not sure how to create it. in c i would just pass a pointer to such an empty array but i’m not sure what the kotlin equivalent is
l

Landry Norris

03/24/2023, 1:44 PM
Create an arena and use arena.alloc<CPointerVar<some_struct>>(). This will give you a double pointer to some_struct.
w

William Reed

03/24/2023, 2:02 PM
thank you 🙂
4 Views