Package kotlin.native

Types

BitSet
Link copied to clipboard
class BitSet(size: Int)

A vector of bits growing if necessary and allowing one to set/clear/read bits from it by a bit index.

CName
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class CName(externName: String, shortName: String)

Makes top level function available from C/C++ code with the given name.

CpuArchitecture
Link copied to clipboard
enum CpuArchitecture : Enum<CpuArchitecture>

Central Processor Unit architecture.

ImmutableBlob
Link copied to clipboard
class ImmutableBlob

An immutable compile-time array of bytes.

IncorrectDereferenceException
Link copied to clipboard
class IncorrectDereferenceException : RuntimeException

Exception thrown when top level variable is accessed from incorrect execution context.

MemoryModel
Link copied to clipboard
enum MemoryModel : Enum<MemoryModel>

Memory model.

OsFamily
Link copied to clipboard
enum OsFamily : Enum<OsFamily>

Operating system family.

Platform
Link copied to clipboard
object Platform

Object describing the current platform program executes upon.

ReportUnhandledExceptionHook
Link copied to clipboard
typealias ReportUnhandledExceptionHook = (Throwable) -> Unit

Typealias describing custom exception reporting hook.

Retain
Link copied to clipboard
annotation class Retain

Preserve the function entry point during global optimizations.

RetainForTarget
Link copied to clipboard
annotation class RetainForTarget(target: String)

Preserve the function entry point during global optimizations, only for the given target.

SymbolName
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class SymbolName(name: String)

Forces the compiler to use specified symbol name for the target external function.

Vector128
Link copied to clipboard
class Vector128

Functions

asCPointer
Link copied to clipboard
fun ImmutableBlob.asCPointer(offset: Int = 0): CPointer<ByteVar>

Returns stable C pointer to data at certain offset, useful as a way to pass resource to C APIs.

asUCPointer
Link copied to clipboard
fun ImmutableBlob.asUCPointer(offset: Int = 0): CPointer<UByteVar>
deinitRuntimeIfNeeded
Link copied to clipboard
external fun deinitRuntimeIfNeeded()

Deinitializes Kotlin runtime for the current thread, if was inited. Cannot be called from Kotlin frames holding references, thus deprecated.

getCharAt
Link copied to clipboard
external fun ByteArray.getCharAt(index: Int): Char

Gets Char out of the ByteArray byte buffer at specified index index

getDoubleAt
Link copied to clipboard
external fun ByteArray.getDoubleAt(index: Int): Double

Gets Double out of the ByteArray byte buffer at specified index index

getFloatAt
Link copied to clipboard
external fun ByteArray.getFloatAt(index: Int): Float

Gets Float out of the ByteArray byte buffer at specified index index

getIntAt
Link copied to clipboard
external fun ByteArray.getIntAt(index: Int): Int

Gets Int out of the ByteArray byte buffer at specified index index

getLongAt
Link copied to clipboard
external fun ByteArray.getLongAt(index: Int): Long

Gets Long out of the ByteArray byte buffer at specified index index

getShortAt
Link copied to clipboard
external fun ByteArray.getShortAt(index: Int): Short

Gets Short out of the ByteArray byte buffer at specified index index

getStackTraceAddresses
Link copied to clipboard
fun Throwable.getStackTraceAddresses(): List<Long>

Returns a list of stack trace addresses representing the stack trace pertaining to this throwable.

getUByteAt
Link copied to clipboard
@ExperimentalUnsignedTypes
fun ByteArray.getUByteAt(index: Int): UByte

Gets UByte out of the ByteArray byte buffer at specified index index

getUIntAt
Link copied to clipboard
@ExperimentalUnsignedTypes
external fun ByteArray.getUIntAt(index: Int): UInt

Gets UInt out of the ByteArray byte buffer at specified index index

getULongAt
Link copied to clipboard
@ExperimentalUnsignedTypes
external fun ByteArray.getULongAt(index: Int): ULong

Gets ULong out of the ByteArray byte buffer at specified index index

getUShortAt
Link copied to clipboard
@ExperimentalUnsignedTypes
external fun ByteArray.getUShortAt(index: Int): UShort

Gets UShort out of the ByteArray byte buffer at specified index index

identityHashCode
Link copied to clipboard
external fun Any?.identityHashCode(): Int

Compute stable wrt potential object relocations by the memory manager identity hash code.

immutableBlobOf
Link copied to clipboard
external fun immutableBlobOf(vararg elements: Short): ImmutableBlob

Creates ImmutableBlob out of compile-time constant data.

initRuntimeIfNeeded
Link copied to clipboard
external fun initRuntimeIfNeeded()

Initializes Kotlin runtime for the current thread, if not inited already.

setCharAt
Link copied to clipboard
external fun ByteArray.setCharAt(index: Int, value: Char)

Sets Char out of the ByteArray byte buffer at specified index index

setDoubleAt
Link copied to clipboard
external fun ByteArray.setDoubleAt(index: Int, value: Double)

Sets Double out of the ByteArray byte buffer at specified index index

setFloatAt
Link copied to clipboard
external fun ByteArray.setFloatAt(index: Int, value: Float)

Sets Float out of the ByteArray byte buffer at specified index index

setIntAt
Link copied to clipboard
external fun ByteArray.setIntAt(index: Int, value: Int)

Sets Int out of the ByteArray byte buffer at specified index index

setLongAt
Link copied to clipboard
external fun ByteArray.setLongAt(index: Int, value: Long)

Sets Long out of the ByteArray byte buffer at specified index index

setShortAt
Link copied to clipboard
external fun ByteArray.setShortAt(index: Int, value: Short)

Sets Short out of the ByteArray byte buffer at specified index index

setUByteAt
Link copied to clipboard
external fun ByteArray.setUByteAt(index: Int, value: UByte)

Sets UByte out of the ByteArray byte buffer at specified index index

setUIntAt
Link copied to clipboard
external fun ByteArray.setUIntAt(index: Int, value: UInt)

Sets UInt out of the ByteArray byte buffer at specified index index

setULongAt
Link copied to clipboard
@ExperimentalUnsignedTypes
external fun ByteArray.setULongAt(index: Int, value: ULong)

Sets ULong out of the ByteArray byte buffer at specified index index

setUnhandledExceptionHook
Link copied to clipboard

Install custom unhandled exception hook. Returns old hook, or null if it was not specified. Hook is invoked whenever there's uncaught exception reaching boundaries of the Kotlin world, i.e. top level main(), or when Objective-C to Kotlin call not marked with @Throws throws an exception. Hook must be a frozen lambda, so that it could be called from any thread/worker. Hook is invoked once, and is cleared afterwards, so that memory leak detection works as expected even with custom exception hooks.

setUShortAt
Link copied to clipboard
@ExperimentalUnsignedTypes
external fun ByteArray.setUShortAt(index: Int, value: UShort)

Sets UShort out of the ByteArray byte buffer at specified index index

toByteArray
Link copied to clipboard
external fun ImmutableBlob.toByteArray(startIndex: Int = 0, endIndex: Int = size): ByteArray

Copies the data from this blob into a new ByteArray.

toUByteArray
Link copied to clipboard
@ExperimentalUnsignedTypes
external fun ImmutableBlob.toUByteArray(startIndex: Int = 0, endIndex: Int = size): UByteArray

Copies the data from this blob into a new UByteArray.

vectorOf
Link copied to clipboard
external fun vectorOf(f0: Float, f1: Float, f2: Float, f3: Float): Vector128
external fun vectorOf(f0: Int, f1: Int, f2: Int, f3: Int): Vector128