当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。