當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Dart AbiSpecificInteger用法及代碼示例

dart:ffi 庫中AbiSpecificInteger 類的用法介紹如下。

所有 Abi 特定整數類型的超類型。

Abi 特定的整數應該擴展這個類並用 AbiSpecificIntegerMapping 對其進行注釋,以聲明 Abi.values 的整數大小和符號。

例如:

/// The C `uintptr_t` type.
///
/// The [UintPtr] type is a native type, and should not be constructed in
/// Dart code.
/// It occurs only in native type signatures and as annotation on [Struct]
/// and [Union] fields.
@AbiSpecificIntegerMapping({
  Abi.androidArm: Uint32(),
  Abi.androidArm64: Uint64(),
  Abi.androidIA32: Uint32(),
  Abi.androidX64: Uint64(),
  Abi.fuchsiaArm64: Uint64(),
  Abi.fuchsiaX64: Uint64(),
  Abi.iosArm: Uint32(),
  Abi.iosArm64: Uint64(),
  Abi.linuxArm: Uint32(),
  Abi.linuxArm64: Uint64(),
  Abi.linuxIA32: Uint32(),
  Abi.linuxX64: Uint64(),
  Abi.linuxRiscv32: Uint32(),
  Abi.linuxRiscv64: Uint64(),
  Abi.macosArm64: Uint64(),
  Abi.macosX64: Uint64(),
  Abi.windowsIA32: Uint32(),
  Abi.windowsX64: Uint64(),
})
class UintPtr extends AbiSpecificInteger {
  const UintPtr();
}

繼承

Object NativeType AbiSpecificInteger

實施者

Char Int IntPtr Long LongLong Short SignedChar Size UintPtr UnsignedChar UnsignedInt UnsignedLong UnsignedLongLong UnsignedShort WChar

相關用法


注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 AbiSpecificInteger class。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。