asUCPointer

Native
1.3
@DeprecatedSinceKotlin ( "1.9" ) fun ImmutableBlob . asUCPointer (
offset : Int = 0
) : CPointer < UByteVar >

(source)
Deprecated: 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
}

See Also

kotlinx.cinterop.CPointer