asCPointer

Deprecated

Warning since 1.9

ImmutableBlob is deprecated. Use ByteArray instead. To get a stable C pointer to a `ByteArray`, pin it first.

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
}

Since Kotlin

1.3

See also