circu.js
    Preparing search index...

    FFI 类型对象 - 表示 C 语言中的类型

    Index

    Constructors

    • 创建结构体类型

      Parameters

      • ...types: FfiType[]

        成员类型数组

      Returns FfiType

      new FfiType(type_uint32, type_pointer) // 创建包含 uint32 和 pointer 的结构体
      
    • 创建数组类型

      Parameters

      • count: number

        数组元素数量

      • type: FfiType

        元素类型

      Returns FfiType

      new FfiType(10, type_uint8) // 创建 10 个 uint8 的数组
      

    Properties

    name: string

    类型名称(如 "uint32", "pointer")

    size: number

    类型大小(字节)

    type_double: FfiType
    type_float: FfiType
    type_longdouble: FfiType
    type_pointer: FfiType
    type_schar: FfiType
    type_sint: FfiType
    type_sint16: FfiType
    type_sint32: FfiType
    type_sint64: FfiType
    type_sint8: FfiType
    type_size: FfiType
    type_sll: FfiType
    type_slong: FfiType
    type_sshort: FfiType
    type_ssize: FfiType
    type_uchar: FfiType
    type_uint: FfiType
    type_uint16: FfiType
    type_uint32: FfiType
    type_uint64: FfiType
    type_uint8: FfiType
    type_ull: FfiType
    type_ulong: FfiType
    type_ushort: FfiType
    type_void: FfiType

    Methods

    • 从 C 语言缓冲区读取 JavaScript 值

      Parameters

      • buffer: Uint8Array

        包含数据的 Uint8Array

      Returns any

      转换后的 JS 值

    • 将 JavaScript 值转换为 C 语言缓冲区

      Parameters

      • value: any

        要转换的 JS 值(数字、bigint 或数组)

      Returns Uint8Array

      包含转换后数据的 Uint8Array