I'm trying to pass a Scala array to native code and need to do the conversion. How to convert Array[Byte]
to Ptr[Byte]
in Scala Native?
My best solution so far is this:
def makeNativeArray(input: Array[Byte])(using z: Zone): Ptr[Byte] =
val rawSize = input.length
val buffer = alloc[Byte](rawSize)
for i <- 0 until rawSize
do
buffer(i) = input(i)
buffer