Closed
Description
The native API (dart_api.h
) exposes persistent handles to native code through pointers. We should add support to the FFI to creating persistent handles in dart (as ffi.Pointer
s) which can be passed back into native calls. This would be useful, for example, for passing state through native callbacks.
I imagine the API would look something like:
abstract class PersistentHandle extends Pointer<Void> {
PersistentHandle(Object target) native "...";
Object get target native "...";
set target(Object val) native "...";
void destroy() native "...";
}
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
sjindel-google commentedon Sep 24, 2019
This would unlock asynchronous callbacks by enabling Dart to pass SendPorts into C/C++ directly.
[vm/ffi] Convert Objects to Dart_Handles in FFI calls
[benchmarks/ffi] Add FfiCall benchmark with Handles
[vm/ffi] Convert Objects to Dart_Handles in FFI calls