is there anyway to get a `ByteArray` backed by nat...
# kotlin-native
a
is there anyway to get a 
ByteArray
 backed by native C memory without a copy in Kotlin/Native?
2
d
It is. What are you trying to achieve? Have you tried
usePinned
?
t
usePinned
is the common example, but it involves a memory copy. https://stackoverflow.com/a/58521109 Wondering if there is something similar to Javascript interop (whereas a
ByteArray
is transparently mapped to a Javascript
Int8Array
)? https://kotlinlang.org/docs/reference/js-to-kotlin-interop.html#representing-kotlin-types-in-javascript
a
was mostly just trying to avoid a copy (and was curious if I was missing something). Something like JNI DirectByteBuffers. I think I can achieve what I want though by just introducing a
Buffer
interface and then wrap the native memory. Little more work but should achieve what I want.