Package kotlinx.cinterop
Types
ArenaBase
open class ArenaBase : AutofreeScopeAutofreeScope
abstract class AutofreeScope : DeferScope, NativePlacementBooleanVar
typealias BooleanVar = BooleanVarOf<Boolean>BooleanVarOf
class BooleanVarOf<T : Boolean> : CPrimitiveVarByteVarOf
class ByteVarOf<T : Byte> : CPrimitiveVarCArrayPointer
typealias CArrayPointer<T> = CPointer<T>CArrayPointerVar
typealias CArrayPointerVar<T> = CPointerVar<T>CEnum
interface CEnumCEnumVar
abstract class CEnumVar : CPrimitiveVarCOpaquePointerVar
The variable containing a COpaquePointer.
typealias COpaquePointerVar = CPointerVarOf<COpaquePointer>CPointed
C data or code.
abstract class CPointed : NativePointedCPointer
C pointer.
class CPointer<T : CPointed> : CValuesRef<T>CPointerVar
The C data variable containing the pointer to T.
typealias CPointerVar<T> = CPointerVarOf<CPointer<T>>CPrimitiveVar
The C primitive-typed variable located in memory.
sealed class CPrimitiveVar : CVariableCStructVar
The C struct-typed variable located in memory.
abstract class CStructVar : CVariableCValues
The (possibly empty) sequence of immutable C values. It is self-contained and doesn't depend on native memory.
abstract class CValues<T : CVariable> : CValuesRef<T>DeferScope
open class DeferScopeDoubleVar
typealias DoubleVar = DoubleVarOf<Double>DoubleVarOf
class DoubleVarOf<T : Double> : CPrimitiveVarFloatVar
typealias FloatVar = FloatVarOf<Float>FloatVarOf
class FloatVarOf<T : Float> : CPrimitiveVarIntVarOf
class IntVarOf<T : Int> : CPrimitiveVarLongVarOf
class LongVarOf<T : Long> : CPrimitiveVarNativeFreeablePlacement
interface NativeFreeablePlacement : NativePlacementnativeHeap
object nativeHeap : NativeFreeablePlacementNativePlacement
interface NativePlacementNativePointed
The entity which has an associated native pointer. Subtypes are supposed to represent interpretations of the pointed data or code.
open class NativePointedNativePtr
typealias NativePtr = NativePtrObjCBlockVar
typealias ObjCBlockVar<T> = ObjCNotImplementedVar<T>ObjCClass
interface ObjCClass : ObjCObjectObjCClassOf
interface ObjCClassOf<T : ObjCObject> : ObjCClassObjCNotImplementedVar
class ObjCNotImplementedVar<T> : CVariableObjCObject
interface ObjCObjectObjCObjectBase
abstract class ObjCObjectBase : ObjCObjectObjCObjectBaseMeta
abstract class ObjCObjectBaseMeta :
ObjCObjectBase,
ObjCObjectMetaObjCObjectMeta
typealias ObjCObjectMeta = ObjCClassObjCObjectVar
class ObjCObjectVar<T> : CVariableObjCProtocol
interface ObjCProtocol : ObjCObjectObjCStringVarOf
typealias ObjCStringVarOf<T> = ObjCNotImplementedVar<T>Pinned
data class Pinned<out T : Any>ShortVar
typealias ShortVar = ShortVarOf<Short>ShortVarOf
class ShortVarOf<T : Short> : CPrimitiveVarStableObjPtr
typealias StableObjPtr = StableRef<*>StableRef
This class provides a way to create a stable handle to any Kotlin object. After converting to CPointer it can be safely passed to native code e.g. to be received in a Kotlin callback.
class StableRef<out T : Any>UByteVar
typealias UByteVar = UByteVarOf<UByte>UByteVarOf
class UByteVarOf<T : UByte> : CPrimitiveVarUIntVarOf
class UIntVarOf<T : UInt> : CPrimitiveVarULongVar
typealias ULongVar = ULongVarOf<ULong>ULongVarOf
class ULongVarOf<T : ULong> : CPrimitiveVarUShortVar
typealias UShortVar = UShortVarOf<UShort>UShortVarOf
class UShortVarOf<T : UShort> : CPrimitiveVarVector128Var
typealias Vector128Var = Vector128VarOf<Vector128>Annotations
ExportObjCClass
Makes Kotlin subclass of Objective-C class visible for runtime lookup
after Kotlin main function gets invoked.
annotation class ExportObjCClassExternalObjCClass
annotation class ExternalObjCClassInteropStubs
annotation class InteropStubsObjCAction
Makes Kotlin method in Objective-C class accessible through Objective-C dispatch to be used as action sent by control in UIKit or AppKit.
annotation class ObjCActionObjCConstructor
annotation class ObjCConstructorObjCFactory
annotation class ObjCFactoryObjCMethod
annotation class ObjCMethodObjCOutlet
Makes Kotlin property in Objective-C class settable through Objective-C dispatch to be used as IB outlet.
annotation class ObjCOutletProperties
nativeNullPtr
val nativeNullPtr: NativePtrpointed
The code or data pointed by the value of this variable.
var <T : CPointed, P : CPointer<T>> CPointerVarOf<P>.pointed: T?rawPtr
val NativePointed?.rawPtr: NativePtrvalue
var <T : Boolean> BooleanVarOf<T>.value: Tvar <T : Byte> ByteVarOf<T>.value: Tvar <T : Short> ShortVarOf<T>.value: Tvar <T : Int> IntVarOf<T>.value: Tvar <T : Long> LongVarOf<T>.value: Tvar <T : UByte> UByteVarOf<T>.value: Tvar <T : UShort> UShortVarOf<T>.value: Tvar <T : ULong> ULongVarOf<T>.value: Tvar <T : Float> FloatVarOf<T>.value: Tvar <T : Double> DoubleVarOf<T>.value: Tvar <T : Vector128> Vector128VarOf<T>.value: Tvar <T> ObjCNotImplementedVar<T>.value: Tvar <T> ObjCObjectVar<T>.value: TThe value of this variable.
var <P : CPointer<*>> CPointerVarOf<P>.value: P?Functions
addressOf
fun Pinned<ShortArray>.addressOf(
index: Int
): CPointer<ShortVar>fun Pinned<UByteArray>.addressOf(
index: Int
): CPointer<UByteVar>fun Pinned<UShortArray>.addressOf(
index: Int
): CPointer<UShortVar>fun Pinned<ULongArray>.addressOf(
index: Int
): CPointer<ULongVar>fun Pinned<FloatArray>.addressOf(
index: Int
): CPointer<FloatVar>fun Pinned<DoubleArray>.addressOf(
index: Int
): CPointer<DoubleVar>alloc
Allocates variable of given type.
fun <T : CVariable> NativePlacement.alloc(): TAllocates variable of given type and initializes it applying given block.
fun <T : CVariable> NativePlacement.alloc(
initialize: T.() -> Unit
): TallocArray
Allocates C array of given elements type and length.
fun <T : CVariable> NativePlacement.allocArray(
length: Long
): CArrayPointer<T>fun <T : CVariable> NativePlacement.allocArray(
length: Int
): CArrayPointer<T>Allocates C array of given elements type and length, and initializes its elements applying given block.
fun <T : CVariable> NativePlacement.allocArray(
length: Long,
initializer: T.(index: Long) -> Unit
): CArrayPointer<T>fun <T : CVariable> NativePlacement.allocArray(
length: Int,
initializer: T.(index: Int) -> Unit
): CArrayPointer<T>allocArrayOf
Allocates C array of given values.
fun <T : CPointer<*>> NativePlacement.allocArrayOf(
vararg elements: T?
): CArrayPointer<CPointerVarOf<T>>fun <T : CPointer<*>> NativePlacement.allocArrayOf(
elements: List<T?>
): CArrayPointer<CPointerVarOf<T>>fun NativePlacement.allocArrayOf(
elements: ByteArray
): CArrayPointer<ByteVar>fun NativePlacement.allocArrayOf(
vararg elements: Float
): CArrayPointer<FloatVar>allocArrayOfPointersTo
Allocates C array of pointers to given elements.
fun <T : CPointed> NativePlacement.allocArrayOfPointersTo(
elements: List<T?>
): CArrayPointer<CPointerVar<T>>fun <T : CPointed> NativePlacement.allocArrayOfPointersTo(
vararg elements: T?
): CArrayPointer<CPointerVar<T>>allocPointerTo
fun <T : CPointed> NativePlacement.allocPointerTo(): CPointerVar<T>arrayMemberAt
fun <T : CVariable> CStructVar.arrayMemberAt(
offset: Long
): CArrayPointer<T>asStableRef
Converts to StableRef this opaque pointer produced by StableRef.asCPointer.
autoreleasepool
fun <R> autoreleasepool(block: () -> R): RbitsToDouble
fun bitsToDouble(bits: Long): DoublebitsToFloat
fun bitsToFloat(bits: Int): Floatcopy
fun <T : CStructVar> CValue<T>.copy(
modify: T.() -> Unit
): CValue<T>createKotlinObjectHolder
fun createKotlinObjectHolder(any: Any?): NativePtrCreateKStringFromNSString
fun CreateKStringFromNSString(ptr: NativePtr): String?CreateNSStringFromKString
fun CreateNSStringFromKString(str: String?): NativePtrcValue
fun <T : CStructVar> cValue(
initialize: T.() -> Unit
): CValue<T>cValuesOf
Returns sequence of immutable values CValues to pass them to C code.
fun <T : CPointed> cValuesOf(
vararg elements: CPointer<T>?
): CValues<CPointerVar<T>>free
fun NativeFreeablePlacement.free(pointer: CPointer<*>)fun NativeFreeablePlacement.free(pointed: NativePointed)get
operator fun <T : Short> CPointer<ShortVarOf<T>>.get(
index: Int
): Toperator fun <T : Short> CPointer<ShortVarOf<T>>.get(
index: Long
): Toperator fun <T : UByte> CPointer<UByteVarOf<T>>.get(
index: Int
): Toperator fun <T : UByte> CPointer<UByteVarOf<T>>.get(
index: Long
): Toperator fun <T : UShort> CPointer<UShortVarOf<T>>.get(
index: Int
): Toperator fun <T : UShort> CPointer<UShortVarOf<T>>.get(
index: Long
): Toperator fun <T : ULong> CPointer<ULongVarOf<T>>.get(
index: Int
): Toperator fun <T : ULong> CPointer<ULongVarOf<T>>.get(
index: Long
): Toperator fun <T : Float> CPointer<FloatVarOf<T>>.get(
index: Int
): Toperator fun <T : Float> CPointer<FloatVarOf<T>>.get(
index: Long
): Toperator fun <T : Double> CPointer<DoubleVarOf<T>>.get(
index: Int
): Toperator fun <T : Double> CPointer<DoubleVarOf<T>>.get(
index: Long
): Toperator fun <T : CPointer<*>> CPointer<CPointerVarOf<T>>.get(
index: Int
): T?operator fun <T : CPointer<*>> CPointer<CPointerVarOf<T>>.get(
index: Long
): T?getOriginalKotlinClass
If objCClass is a class generated to Objective-C header for Kotlin class, returns KClass for that original Kotlin class.
If objCProtocol is a protocol generated to Objective-C header for Kotlin class, returns KClass for that original Kotlin class.
fun getOriginalKotlinClass(
objCProtocol: ObjCProtocol
): KClass<*>?getRawPointer
fun NativePointed.getRawPointer(): NativePtrinitBy
fun <T : ObjCObjectBase> T.initBy(constructorCall: T): TinterpretNullableOpaquePointed
fun interpretNullableOpaquePointed(
ptr: NativePtr
): NativePointed?interpretNullablePointed
Performs type cast of the native pointer to given interop type, including null values.
fun <T : NativePointed> interpretNullablePointed(
ptr: NativePtr
): T?interpretObjCPointer
fun <T : Any> interpretObjCPointer(objcPtr: NativePtr): TinterpretObjCPointerOrNull
fun <T> interpretObjCPointerOrNull(objcPtr: NativePtr): T?interpretOpaquePointed
fun interpretOpaquePointed(ptr: NativePtr): NativePointedinterpretPointed
Returns interpretation of entity with given pointer.
fun <T : NativePointed> interpretPointed(ptr: NativePtr): Tinvoke
operator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16,
p17: P17
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16,
p17: P17,
p18: P18
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16,
p17: P17,
p18: P18,
p19: P19
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16,
p17: P17,
p18: P18,
p19: P19,
p20: P20
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16,
p17: P17,
p18: P18,
p19: P19,
p20: P20,
p21: P21
): Roperator fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R> CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R>>.invoke(
p1: P1,
p2: P2,
p3: P3,
p4: P4,
p5: P5,
p6: P6,
p7: P7,
p8: P8,
p9: P9,
p10: P10,
p11: P11,
p12: P12,
p13: P13,
p14: P14,
p15: P15,
p16: P16,
p17: P17,
p18: P18,
p19: P19,
p20: P20,
p21: P21,
p22: P22
): RmemberAt
Returns the member of this CStructVar which is located by given offset in bytes.
fun <T : CPointed> CStructVar.memberAt(offset: Long): Tobjc_autoreleasePoolPop
fun objc_autoreleasePoolPop(ptr: NativePtr)objc_autoreleasePoolPush
fun objc_autoreleasePoolPush(): NativePtrobjc_release
fun objc_release(ptr: NativePtr)placeTo
fun <T : CVariable> CValues<T>.placeTo(
scope: AutofreeScope
): CPointer<T>readBytes
fun COpaquePointer.readBytes(count: Int): ByteArrayreadValue
fun <T : CStructVar> T.readValue(): CValue<T>refTo
fun ByteArray.refTo(index: Int): CValuesRef<ByteVar>fun ShortArray.refTo(index: Int): CValuesRef<ShortVar>fun IntArray.refTo(index: Int): CValuesRef<IntVar>fun LongArray.refTo(index: Int): CValuesRef<LongVar>fun UByteArray.refTo(index: Int): CValuesRef<UByteVar>fun UShortArray.refTo(index: Int): CValuesRef<UShortVar>fun UIntArray.refTo(index: Int): CValuesRef<UIntVar>fun ULongArray.refTo(index: Int): CValuesRef<ULongVar>fun FloatArray.refTo(index: Int): CValuesRef<FloatVar>fun DoubleArray.refTo(index: Int): CValuesRef<DoubleVar>reinterpret
Changes the interpretation of the pointed data or code.
fun <T : NativePointed> NativePointed.reinterpret(): Tfun <T : ObjCObject> ObjCObject.reinterpret(): Tset
operator fun <T : Short> CPointer<ShortVarOf<T>>.set(
index: Int,
value: T)operator fun <T : Short> CPointer<ShortVarOf<T>>.set(
index: Long,
value: T)operator fun <T : UByte> CPointer<UByteVarOf<T>>.set(
index: Int,
value: T)operator fun <T : UByte> CPointer<UByteVarOf<T>>.set(
index: Long,
value: T)operator fun <T : UShort> CPointer<UShortVarOf<T>>.set(
index: Int,
value: T)operator fun <T : UShort> CPointer<UShortVarOf<T>>.set(
index: Long,
value: T)operator fun <T : ULong> CPointer<ULongVarOf<T>>.set(
index: Int,
value: T)operator fun <T : ULong> CPointer<ULongVarOf<T>>.set(
index: Long,
value: T)operator fun <T : Float> CPointer<FloatVarOf<T>>.set(
index: Int,
value: T)operator fun <T : Float> CPointer<FloatVarOf<T>>.set(
index: Long,
value: T)operator fun <T : Double> CPointer<DoubleVarOf<T>>.set(
index: Int,
value: T)operator fun <T : Double> CPointer<DoubleVarOf<T>>.set(
index: Long,
value: T)operator fun <T : CPointer<*>> CPointer<CPointerVarOf<T>>.set(
index: Int,
value: T?)operator fun <T : CPointer<*>> CPointer<CPointerVarOf<T>>.set(
index: Long,
value: T?)staticCFunction
Returns a pointer to C function which calls given Kotlin static function.
fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R> staticCFunction(
function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R
): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> R>>fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R> staticCFunction(
function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R
): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> R>>fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R> staticCFunction(
function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R
): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> R>>fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R> staticCFunction(
function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R
): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> R>>fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R> staticCFunction(
function: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R
): CPointer<CFunction<(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> R>>toBoolean
fun Byte.toBoolean(): BooleantoByte
fun Boolean.toByte(): BytetoCStringArray
Convert this list of Kotlin strings to C array of C strings, allocating memory for the array and C strings with given AutofreeScope.
fun List<String>.toCStringArray(
autofreeScope: AutofreeScope
): CPointer<CPointerVar<ByteVar>>Convert this array of Kotlin strings to C array of C strings, allocating memory for the array and C strings with given AutofreeScope.
fun Array<String>.toCStringArray(
autofreeScope: AutofreeScope
): CPointer<CPointerVar<ByteVar>>toCValues
fun ShortArray.toCValues(): CValues<ShortVar>fun FloatArray.toCValues(): CValues<FloatVar>fun DoubleArray.toCValues(): CValues<DoubleVar>fun <T : CPointed> Array<CPointer<T>?>.toCValues(): CValues<CPointerVar<T>>fun <T : CPointed> List<CPointer<T>?>.toCValues(): CValues<CPointerVar<T>>fun UByteArray.toCValues(): CValues<UByteVar>fun UShortArray.toCValues(): CValues<UShortVar>fun ULongArray.toCValues(): CValues<ULongVar>toKString
Decodes a string from the bytes in UTF-8 encoding in this array.
Bytes following the first occurrence of 0 byte, if it occurs, are not decoded.
fun ByteArray.toKString(): StringDecodes a string from the bytes in UTF-8 encoding in this array or its subrange.
Bytes following the first occurrence of 0 byte, if it occurs, are not decoded.
fun ByteArray.toKString(
startIndex: Int = 0,
endIndex: Int = this.size,
throwOnInvalidSequence: Boolean = false
): StringunwrapKotlinObjectHolder
fun <T : Any> unwrapKotlinObjectHolder(holder: Any?): TuseContents
Calls the block with temporary copy if this value as receiver.
fun <T : CStructVar, R> CValue<T>.useContents(
block: T.() -> R
): R