asCPointer
@DeprecatedSinceKotlin
(
"1.9"
)
fun
ImmutableBlob
.
asCPointer
(
offset
:
Int
=
0
)
:
CPointer
<
ByteVar
>
(source)
Returns stable C pointer to data at certain offset , useful as a way to pass resource to C APIs.
ImmutableBlob
is deprecated since Kotlin 1.9. It is recommended to use
ByteArray
instead.
To get a stable C pointer to
ByteArray
data the array needs to be pinned first.
byteArray.usePinned {
val cpointer = it.addressOf(offset)
// use the stable C pointer
}
See Also