Description
https://dart-review.googlesource.com/c/sdk/+/338020 adds support for #50551, but does not add support for global fixed size arrays.
double foo[4];
double return_double() {
return foo[1];
}
void set_double(double value) {
foo[2] = value;
}
Could theoretically be bound to.
@Array(4)
@Native()
external Array<Double> foo;
It just so happens to be that currently the following works because the memory layout is identical.
@Native()
external Pointer<Double> foo;
The advantage of supporting the latter is that we can do bound checks on use.
@simolus3 Thanks for making the Array
limitation explicit in https://dart-review.googlesource.com/c/sdk/+/338020. Here are some of my thoughts about it.
Re dart-lang/native#860, should we temporarily support generating Pointer
s for fixed-size global arrays? That would make it a breaking change later to make it Arrays, though. On the other hand, if users would like to use those fields than without generating Pointer
s, users can't use FFIgen at all.