DetachedObjectGraph

Deprecated

Error since 2.1

Support for the legacy memory manager has been completely removed. Use the pointed value directly. To pass the value through the C interop, use the StableRef class.

Detached object graph encapsulates transferrable detached subgraph which cannot be accessed externally, until it is attached with the attach extension function.

Since Kotlin

1.3

Constructors

Link copied to clipboard
constructor(mode: TransferMode = TransferMode.SAFE, producer: () -> T)

Creates stable pointer to object, ensuring associated object subgraph is disjoint in specified mode (TransferMode.SAFE by default). Raw value returned by asCPointer could be stored to a C variable or passed to another Kotlin machine.

constructor(pointer: COpaquePointer?)

Restores detached object graph from the value stored earlier in a C raw pointer.

Functions

Link copied to clipboard

Returns raw C pointer value, usable for interoperability with C scenarious.

Since Kotlin 1.3
Link copied to clipboard

Attaches previously detached object subgraph created by DetachedObjectGraph. Please note, that once object graph is attached, the DetachedObjectGraph.stable pointer does not make sense anymore, and shall be discarded, so attach of one DetachedObjectGraph object can only happen once.

Since Kotlin 1.3