[vm/ffi] Static @NativeCallback
s API
#51384
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
@mkustermann suggested we should have static binding for native callbacks as well, as the dual for the
@Native external
functions.We would move the information from
Pointer.fromFunction
to the declaration site (static functions):Having this more static information would make it in the future possible to compile a Dart aot snapshot in such a way to statically link unresolved symbols from C static libraries to the Dart functions (or rather the FFI callback trampolines for these). The dual to:
FfiNative
for static linking #49418The
NativeCallback
definition would look something like:This would prevent using the same Dart function as callback with two different settings, but that could be worked around by creating two top level functions with differing
@NativeCallback
annotations.The new API would not support closures (which is also prohibited in the current API). But, for closures we likely need some API that would enable us to weakly hold on to an isolate and tell an isolate that a closure can be released.
Related issues:
CallbackSemantics
as another optional positional argument for the time being.addressOf
dual for native functions instead of Dart functions.cc @liamappelbe, @mkustermann, @mraleph
The text was updated successfully, but these errors were encountered: