W3cubDocs

/Kotlin

CValuesRef

Platform and version requirements: Native (1.3)
abstract class CValuesRef<T : CPointed>

Represents a reference to (possibly empty) sequence of C values. It can be either a stable pointer CPointer or a sequence of immutable values CValues.

CValuesRef is designed to be used as Kotlin representation of pointer-typed parameters of C functions. When passing CPointer as CValuesRef to the Kotlin binding method, the C function receives exactly this pointer. Passing CValues has nearly the same semantics as passing by value: the C function receives the pointer to the temporary copy of these values, and the caller can't observe the modifications to this copy. The copy is valid until the C function returns. There are also other implementations of CValuesRef that provide temporary pointer, e.g. Kotlin Native specific refTo functions to pass primitive arrays directly to native.

Constructors

Platform and version requirements: Native (1.3)

<init>

Represents a reference to (possibly empty) sequence of C values. It can be either a stable pointer CPointer or a sequence of immutable values CValues.

CValuesRef()

Functions

Platform and version requirements: Native (1.3)

getPointer

If this reference is CPointer, returns this pointer, otherwise allocate storage value in the scope and return it.

abstract fun getPointer(scope: AutofreeScope): CPointer<T>

Inheritors

Platform and version requirements: Native (1.3)

CPointer

C pointer.

class CPointer<T : CPointed> : CValuesRef<T>
Platform and version requirements: Native (1.3)

CValues

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>

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlinx.cinterop/-c-values-ref/index.html