[vm/ffi] asTypedList
for Pointer<T extends AbiSpecificInteger>
#54119
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
P3
A lower priority bug or feature request
triaged
Issue has been triaged by sub team
Once #44589 is addressed, there is a question about how to provide a Dart API to users which has a
size_t*
in C.For
uint32_t*
, the Dart API can beUint32List
. But for a type that is architecture dependent, we require runtime polymorphism at the moment. We could make the API returnList<int>
and takeList<int>
and try to cast, but polymorphism makes code slow.We probably also don't want to introduce a
SizeList
,IntptrList
,UintptrList
todart:typed_data
. We introducedAbiSpecificInteger
todart:ffi
to avoid hardcoding every possible type. Would it be possible to introduce aAbiSpecificTypedData<AbiSpecificInteger>
todart:typed_data
ordart:ffi
maybe?Use case in ICU4X:
https://github.com/unicode-org/icu4x/blob/1c0b95ef95d869841fec45ed0e7b107b47c8afad/ffi/capi/dart/package/lib/src/lib.g.dart#L137-L144
Thanks @robertbastian for reporting!
Any thoughts @mkustermann @mraleph @lrhn ?
The text was updated successfully, but these errors were encountered: