Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vm/ffi] Array.fromTypedData constructors #54525

Open
dcharkes opened this issue Jan 5, 2024 · 0 comments
Open

[vm/ffi] Array.fromTypedData constructors #54525

dcharkes opened this issue Jan 5, 2024 · 0 comments
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 type-enhancement A request for a change that isn't a bug

Comments

@dcharkes
Copy link
Contributor

dcharkes commented Jan 5, 2024

In [vm/ffi] TypedData constructors for Struct and Union addressing #53418, structs and unions can be instantiated with an existing typed data.

We should consider doing the same for Array.

Related:

Workaround for compile-time length arrays

After https://dart-review.googlesource.com/c/sdk/+/342763 lands.

Define a wrapper struct, create the wrapper struct with that typed data, and read the array out:

main() {
  final typedData = ...;
  final Array<MyStruct> a = HelperStruct(typedData).inlineArray;
}

class HelperStruct extends Struct {
  @Array(10)
  external Array<Struct> inlineArray;
}
@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi labels Jan 5, 2024
@a-siva a-siva added type-enhancement A request for a change that isn't a bug P3 A lower priority bug or feature request triaged Issue has been triaged by sub team labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants