scala.scalanative.unsafe

Type members

Classlikes

final class CArray[T, N <: Nat]
sealed abstract class CFuncPtr
Companion:
object
object CFuncPtr
Companion:
class
final class CFuncPtr0[R] extends CFuncPtr
Companion:
object
object CFuncPtr0
Companion:
class
final class CFuncPtr1[T1, R] extends CFuncPtr
Companion:
object
object CFuncPtr1
Companion:
class
final class CFuncPtr10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R] extends CFuncPtr
Companion:
object
object CFuncPtr10
Companion:
class
final class CFuncPtr11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R] extends CFuncPtr
Companion:
object
object CFuncPtr11
Companion:
class
final class CFuncPtr12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R] extends CFuncPtr
Companion:
object
object CFuncPtr12
Companion:
class
final class CFuncPtr13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R] extends CFuncPtr
Companion:
object
object CFuncPtr13
Companion:
class
final class CFuncPtr14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R] extends CFuncPtr
Companion:
object
object CFuncPtr14
Companion:
class
final class CFuncPtr15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R] extends CFuncPtr
Companion:
object
object CFuncPtr15
Companion:
class
final class CFuncPtr16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R] extends CFuncPtr
Companion:
object
object CFuncPtr16
Companion:
class
final class CFuncPtr17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] extends CFuncPtr
Companion:
object
object CFuncPtr17
Companion:
class
final class CFuncPtr18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R] extends CFuncPtr
Companion:
object
object CFuncPtr18
Companion:
class
final class CFuncPtr19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R] extends CFuncPtr
Companion:
object
object CFuncPtr19
Companion:
class
final class CFuncPtr2[T1, T2, R] extends CFuncPtr
Companion:
object
object CFuncPtr2
Companion:
class
final class CFuncPtr20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R] extends CFuncPtr
Companion:
object
object CFuncPtr20
Companion:
class
final class CFuncPtr21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R] extends CFuncPtr
Companion:
object
object CFuncPtr21
Companion:
class
final class CFuncPtr22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R] extends CFuncPtr
Companion:
object
object CFuncPtr22
Companion:
class
final class CFuncPtr3[T1, T2, T3, R] extends CFuncPtr
Companion:
object
object CFuncPtr3
Companion:
class
final class CFuncPtr4[T1, T2, T3, T4, R] extends CFuncPtr
Companion:
object
object CFuncPtr4
Companion:
class
final class CFuncPtr5[T1, T2, T3, T4, T5, R] extends CFuncPtr
Companion:
object
object CFuncPtr5
Companion:
class
final class CFuncPtr6[T1, T2, T3, T4, T5, T6, R] extends CFuncPtr
Companion:
object
object CFuncPtr6
Companion:
class
final class CFuncPtr7[T1, T2, T3, T4, T5, T6, T7, R] extends CFuncPtr
Companion:
object
object CFuncPtr7
Companion:
class
final class CFuncPtr8[T1, T2, T3, T4, T5, T6, T7, T8, R] extends CFuncPtr
Companion:
object
object CFuncPtr8
Companion:
class
final class CFuncPtr9[T1, T2, T3, T4, T5, T6, T7, T8, T9, R] extends CFuncPtr
Companion:
object
object CFuncPtr9
Companion:
class
implicit class CQuote(val ctx: StringContext)

C-style string literal.

C-style string literal.

sealed abstract class CStruct
final class CStruct0 extends CStruct
final class CStruct1[T1] extends CStruct
final class CStruct10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] extends CStruct
final class CStruct11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11] extends CStruct
final class CStruct12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12] extends CStruct
final class CStruct13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13] extends CStruct
final class CStruct14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14] extends CStruct
final class CStruct15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15] extends CStruct
final class CStruct16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16] extends CStruct
final class CStruct17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17] extends CStruct
final class CStruct18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18] extends CStruct
final class CStruct19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19] extends CStruct
final class CStruct2[T1, T2] extends CStruct
final class CStruct20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20] extends CStruct
final class CStruct21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21] extends CStruct
final class CStruct22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22] extends CStruct
final class CStruct3[T1, T2, T3] extends CStruct
final class CStruct4[T1, T2, T3, T4] extends CStruct
final class CStruct5[T1, T2, T3, T4, T5] extends CStruct
final class CStruct6[T1, T2, T3, T4, T5, T6] extends CStruct
final class CStruct7[T1, T2, T3, T4, T5, T6, T7] extends CStruct
final class CStruct8[T1, T2, T3, T4, T5, T6, T7, T8] extends CStruct
final class CStruct9[T1, T2, T3, T4, T5, T6, T7, T8, T9] extends CStruct
final class CVarArg(val value: Any, val tag: Tag[Any])

Type of a C-style vararg in an extern method.

Type of a C-style vararg in an extern method.

Companion:
object
object CVarArg
Companion:
class
final class CVarArgList

Type of a C-style vararg list (va_list in C).

Type of a C-style vararg list (va_list in C).

Companion:
object
Companion:
class
final class MemoryPoolZone(pool: MemoryPool) extends Zone

An optimized implementation of a zone that performs all allocations sequentially in pages that are claimed from memory pool. Larger allocations are allocated using the system allocator and persisted in an array buffer.

An optimized implementation of a zone that performs all allocations sequentially in pages that are claimed from memory pool. Larger allocations are allocated using the system allocator and persisted in an array buffer.

sealed abstract class Nat
Companion:
object
object Nat
Companion:
class
final class Ptr[T]
Companion:
object
object Ptr
Companion:
class
final class Size(val rawSize: RawSize) extends ScalaNumber with Comparable[Size]
Companion:
object
object Size
Companion:
class
sealed abstract class Tag[T]
Companion:
object
object Tag
Companion:
class
final implicit class UnsafeRichArray[T](val value: Array[T]) extends AnyVal

Scala Native unsafe extensions to Arrays

Scala Native unsafe extensions to Arrays

final implicit class UnsafeRichByte(val value: Byte) extends AnyVal

Scala Native unsafe extensions to the standard Byte.

Scala Native unsafe extensions to the standard Byte.

final implicit class UnsafeRichInt(val value: Int) extends AnyVal

Scala Native unsafe extensions to the standard Int.

Scala Native unsafe extensions to the standard Int.

final implicit class UnsafeRichLong(val value: Long) extends AnyVal

Scala Native unsafe extensions to the standard Long.

Scala Native unsafe extensions to the standard Long.

final implicit class UnsafeRichShort(val value: Short) extends AnyVal

Scala Native unsafe extensions to the standard Short.

Scala Native unsafe extensions to the standard Short.

@implicitNotFound("Given method requires an implicit zone.")
trait Zone

Zone allocator which manages memory allocations.

Zone allocator which manages memory allocations.

Companion:
object
final class blocking extends StaticAnnotation

An annotation that is used to mark methods that contain externally-defined and potentially blocking methods

An annotation that is used to mark methods that contain externally-defined and potentially blocking methods

final class define extends StaticAnnotation

An annotation that is used to automatically define a macro when the annotated symbol is used.

An annotation that is used to automatically define a macro when the annotated symbol is used.

final class exportAccessors(getterName: String, setterName: String) extends StaticAnnotation

An annotation that is used to mark static fields for which should be generated external accesor (entry points in library)

An annotation that is used to mark static fields for which should be generated external accesor (entry points in library)

final class exported(name: String) extends StaticAnnotation

An annotation that is used to mark methods that should be treated as library entry point

An annotation that is used to mark methods that should be treated as library entry point

final class extern extends StaticAnnotation

An annotation that is used to mark objects that contain externally-defined members

An annotation that is used to mark objects that contain externally-defined members

final class link(name: String) extends StaticAnnotation

An annotation that is used to automatically link with native library whenever an annotated extern object is used.

An annotation that is used to automatically link with native library whenever an annotated extern object is used.

final class linkCppRuntime extends StaticAnnotation

An annotation that is used to link the c++ runtime using clang++ instead of clang.

An annotation that is used to link the c++ runtime using clang++ instead of clang.

final class name(name: String) extends StaticAnnotation

An annotation that is used to refer to differently-named native symbol.

An annotation that is used to refer to differently-named native symbol.

Used to annotate methods which should be evaluated in linktime, allowing to remove unused paths and symbols, e.g. whe cross compiling for different OS Annotated methods needs to operate only on literal values, other methods with this annotation.

Used to annotate methods which should be evaluated in linktime, allowing to remove unused paths and symbols, e.g. whe cross compiling for different OS Annotated methods needs to operate only on literal values, other methods with this annotation.

Types

type CBool = Boolean

The C '_Bool' and C++ 'bool' type.

The C '_Bool' and C++ 'bool' type.

type CChar = Byte

The C 'char' type.

The C 'char' type.

The C++ 'char16_t' type.

The C++ 'char16_t' type.

type CChar32 = UInt

The C++ 'char32_t' type.

The C++ 'char32_t' type.

The C 'double' type.

The C 'double' type.

type CFloat = Float

The C 'float' type.

The C 'float' type.

type CInt = Int

The C 'int' type.

The C 'int' type.

type CLong = Size

The C 'long' type.

The C 'long' type.

type CLongInt = Size

The C 'long int' type.

The C 'long int' type.

The C 'long long' type.

The C 'long long' type.

type CPtrDiff = Size

The C/C++ 'ptrdiff_t' type.

The C/C++ 'ptrdiff_t' type.

type CSSize = Size

The C/C++ 'ssize_t' type.

The C/C++ 'ssize_t' type.

type CShort = Short

The C 'short' type.

The C 'short' type.

The C 'signed char' type.

The C 'signed char' type.

type CSize = USize

The C/C++ 'size_t' type.

The C/C++ 'size_t' type.

type CString = Ptr[CChar]

C-style string with trailing 0.

C-style string with trailing 0.

The C 'unsigned char' type.

The C 'unsigned char' type.

The C 'unsigned int' type.

The C 'unsigned int' type.

The C 'unsigned long' type.

The C 'unsigned long' type.

The C 'unsigned long int' type.

The C 'unsigned long int' type.

The C 'unsigned long long' type.

The C 'unsigned long long' type.

The C 'unsigned short' type.

The C 'unsigned short' type.

type CVoidPtr = Ptr[_]

The C/C++ 'void *' type; by convention, not declaration.

The C/C++ 'void *' type; by convention, not declaration.

The C++ 'wchar_t' type.

The C++ 'wchar_t' type.

C-style wide string with trail 0.

C-style wide string with trail 0.

Deprecated types

@deprecated("UWord type is deprecated, use USize instead", since = "0.5.0")
type UWord = USize

UInt on 32-bit architectures and ULong on 64-bit ones.

UInt on 32-bit architectures and ULong on 64-bit ones.

Deprecated
[Since version 0.5.0]
@deprecated("Word type is deprecated, use Size instead", since = "0.5.0")
type Word = Size

Int on 32-bit architectures and Long on 64-bit ones.

Int on 32-bit architectures and Long on 64-bit ones.

Deprecated
[Since version 0.5.0]

Value members

Concrete methods

def extern: Nothing

Used as right hand side of external method and field declarations.

Used as right hand side of external method and field declarations.

def fromCString(cstr: CString, charset: Charset): String

Convert a CString to a String using given charset.

Convert a CString to a String using given charset.

def fromCWideString(cwstr: CWideString, charset: Charset): String

Convert a CWideString to a String using given charset, assumes platform default wchar_t size

Convert a CWideString to a String using given charset, assumes platform default wchar_t size

def fromCWideString(cwstr: Ptr[CChar16], charset: Charset)(implicit d: DummyImplicit): String

Convert a CWideString based on Ptr[CChar16] to a String using given charset

Convert a CWideString based on Ptr[CChar16] to a String using given charset

def tagof[T](implicit tag: Tag[T]): Tag[T]

Materialize tag for given type.

Materialize tag for given type.

def toCString(str: String)(implicit z: Zone): CString

Convert a java.lang.String to a CString using default charset and given allocator.

Convert a java.lang.String to a CString using default charset and given allocator.

def toCString(str: String, charset: Charset)(implicit z: Zone): CString

Convert a java.lang.String to a CString using given charset and allocator.

Convert a java.lang.String to a CString using given charset and allocator.

def toCVarArgList()(implicit z: Zone): CVarArgList

Create an empty CVarArgList.

Create an empty CVarArgList.

def toCVarArgList(vararg: CVarArg, varargs: CVarArg*)(implicit z: Zone): CVarArgList

Convert given CVarArgs into a c CVarArgList.

Convert given CVarArgs into a c CVarArgList.

def toCVarArgList(varargs: Seq[CVarArg])(implicit z: Zone): CVarArgList

Convert a sequence of CVarArg into a c CVarArgList.

Convert a sequence of CVarArg into a c CVarArgList.

def toCWideString(str: String, charset: Charset)(implicit z: Zone): CWideString

Convert a java.lang.String to a CWideString using given charset and allocator.

Convert a java.lang.String to a CWideString using given charset and allocator.

def toCWideStringUTF16LE(str: String)(implicit z: Zone): Ptr[CChar16]

Convert a java.lang.String to a CWideString using given UTF-16 LE charset.

Convert a java.lang.String to a CWideString using given UTF-16 LE charset.

Inherited methods

inline def alignmentOf[T]: Int

The Scala equivalent of C 'alignmentof', but always returns 32-bit integer

The Scala equivalent of C 'alignmentof', but always returns 32-bit integer

Inherited from:
UnsafePackageCompat (hidden)
inline def alignmentof[T]: CSize

The C 'alignmentof' operator.

The C 'alignmentof' operator.

Inherited from:
UnsafePackageCompat (hidden)
inline def alloc[T](inline n: Int)(using zone: Zone): Ptr[T]

Heap allocate and zero-initialize n values using current implicit allocator.

Heap allocate and zero-initialize n values using current implicit allocator.

Inherited from:
UnsafePackageCompat (hidden)
inline def alloc[T](inline n: CSize)(using zone: Zone): Ptr[T]

Heap allocate and zero-initialize n values using current implicit allocator.

Heap allocate and zero-initialize n values using current implicit allocator.

Inherited from:
UnsafePackageCompat (hidden)
inline def alloc[T]()(using zone: Zone): Ptr[T]

Heap allocate and zero-initialize value using current implicit allocator.

Heap allocate and zero-initialize value using current implicit allocator.

Inherited from:
UnsafePackageCompat (hidden)
inline def sizeOf[T]: Int

The Scala equivalent of C 'ssizeof', but always returns 32-bit integer

The Scala equivalent of C 'ssizeof', but always returns 32-bit integer

Inherited from:
UnsafePackageCompat (hidden)
inline def sizeof[T]: CSize

The C 'sizeof' operator.

The C 'sizeof' operator.

Inherited from:
UnsafePackageCompat (hidden)
inline def ssizeof[T]: CSSize

The C 'sizeof' operator.

The C 'sizeof' operator.

Inherited from:
UnsafePackageCompat (hidden)
inline def stackalloc[T](inline n: Int): Ptr[T]

Stack allocate and zero-initialize n values of given type

Stack allocate and zero-initialize n values of given type

Inherited from:
UnsafePackageCompat (hidden)
inline def stackalloc[T](inline n: CSize): Ptr[T]

Stack allocate and zero-initialize n values of given type

Stack allocate and zero-initialize n values of given type

Inherited from:
UnsafePackageCompat (hidden)
inline def stackalloc[T](): Ptr[T]

Stack allocate and zero-initialize value of given type

Stack allocate and zero-initialize value of given type

Inherited from:
UnsafePackageCompat (hidden)

Extensions

Inherited extensions

extension (value: Long)
inline def toPtr[T]: Ptr[T]

Scala Native unsafe extensions to the standard Long.

Scala Native unsafe extensions to the standard Long.

Inherited from:
UnsafePackageCompat (hidden)
inline def toSize: Size

Scala Native unsafe extensions to the standard Long.

Scala Native unsafe extensions to the standard Long.

Inherited from:
UnsafePackageCompat (hidden)
extension (value: Byte)
inline def toSize: Size

Scala Native unsafe extensions to the standard Byte.

Scala Native unsafe extensions to the standard Byte.

Inherited from:
UnsafePackageCompat (hidden)
extension (value: Short)
inline def toSize: Size

Scala Native unsafe extensions to the standard Short.

Scala Native unsafe extensions to the standard Short.

Inherited from:
UnsafePackageCompat (hidden)
extension (value: Int)
inline def toPtr[T]: Ptr[T]

Scala Native unsafe extensions to the standard Int.

Scala Native unsafe extensions to the standard Int.

Inherited from:
UnsafePackageCompat (hidden)
inline def toSize: Size

Scala Native unsafe extensions to the standard Int.

Scala Native unsafe extensions to the standard Int.

Inherited from:
UnsafePackageCompat (hidden)

Implicits

Implicits

final implicit def CQuote(ctx: StringContext): CQuote

C-style string literal.

C-style string literal.

final implicit def UnsafeRichArray[T](value: Array[T]): UnsafeRichArray[T]

Scala Native unsafe extensions to Arrays

Scala Native unsafe extensions to Arrays

final implicit def UnsafeRichByte(value: Byte): UnsafeRichByte

Scala Native unsafe extensions to the standard Byte.

Scala Native unsafe extensions to the standard Byte.

final implicit def UnsafeRichInt(value: Int): UnsafeRichInt

Scala Native unsafe extensions to the standard Int.

Scala Native unsafe extensions to the standard Int.

final implicit def UnsafeRichLong(value: Long): UnsafeRichLong

Scala Native unsafe extensions to the standard Long.

Scala Native unsafe extensions to the standard Long.

final implicit def UnsafeRichShort(value: Short): UnsafeRichShort

Scala Native unsafe extensions to the standard Short.

Scala Native unsafe extensions to the standard Short.