-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expose external typed arrays in dart_api_dl.h #54465
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
Comments
@johnmccutchan What is your use case? Why not pass a |
I tried that but I don't like the lifecycle requirements and ergonomics. Correct me if I'm wrong but I would need something like the following for the finalizer:
The main problem I have with it is that the lifecycle is tied to NativeTypedData and not to the, say, Float32List that I actually want. And unfortunately, I can't make a specialized I'm going to be vending these arrays out to user code and the life cycle will be too subtle and tricky if they have to keep this other object alive when they are really only interested in the typed list. Maybe I'm holding Finalizable wrong? |
No, you should not be needing a
Yes, you want to create that |
Okay, so that solves the finalizer part. Now I'll need to convert it back to a float* when passing it to native code, I suppose I should use a leaf function and have it automatically unwrapped ? |
Correct. 👌 (Please note you need to be on the dev/main branch for that, it landed in December. https://dart-review.googlesource.com/c/sdk/+/338620) |
Yes, I've been using it already. It would be nice if ffigen supported generating the code for unwrapping leaf functions. Unless I missed something I have to manually call LookupFunction with the correct type arguments. |
I'd like to be able to construct external typed arrays in dart_api_dl.h.
Can I expose the APIs?
The text was updated successfully, but these errors were encountered: