Hi everyone, I have two CPointers in kotlin( val v...
# kotlin-native
m
Hi everyone, I have two CPointers in kotlin( val voidPtr = stableRef.asCPointer()) does kotlin have an equivalent substitute of memcpy from C? How do I copy the contents from one pointer to another in kotlin?
d
No there isn't. Mostly because
memcpy
is already available.
👍 2
n
The
memcpy
function is part of the POSIX API ( https://pubs.opengroup.org/onlinepubs/009695399/functions/memcpy.html ), and is available on all the Kotlin Native Linux targets (only a import is required).
m
@napperley only Linux targets? I am running it on windows.
It's working for me on windows as well. I am not sure if I have understood what you said correctly though.
d
He meant, at least linux targets. All targets should have it. (Not sure about wasm though)
m
oh okay. For the channel, it works for windows as well.