dart:ffi Uint64 load/store values which cannot be represented in Dart int #35757
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-ffi
Dart ints are signed 64 bit ints, so they cannot hold the values
[2 ^ 63, ..., 2 ^ 64 - 1]
.We have three options:
Uint64
and interpret the bits asInt64
in Dart.Uint64
, but throw an error if weload
a value that we cannot represent in Dart.Uint64
, and writeInt64
in signatures.Interpret bits differently in Dart
Pro: we can represent the C signatures
Con: interpreting bits differently on
load
/store
can be confusingThrow an error on loading
Pro: explicit that bits are interpreted differently
Con: verbose
Drop Uint64 and use Int64
Con: interpreting bits differently can be confusing
Con 2: signatures of C function in Dart does not correspond to signature in h file
The text was updated successfully, but these errors were encountered: