[vm/ffi] NativeFinalizers with out parameters #54923
Labels
area-documentation
Prefer using 'type-documentation' and a specific area label.
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
Some or
close
/release
functions have a different signature. If such signature requires extra parameters being passed in, such functions can be wrapped in a C function that takes a pointer to a helper struct that has the arguments that should be passed into the finalizer function. One such example would beHeapFree
in the windows API.However, some native finalization functions have out parameters that communicate error messages. Because native finalization functions cannot call back into Dart, the only way to communicate such information to Dart is to use an
NativeCallable.listener
to communicate the errors back to the isolate. Since finalizers are run async anyway, I believe this is a reasonable thing to do.Any other ideas on how to deal with this @mkustermann? Or do you think scheduling something on the Dart event loop with
NativeCallable.listener
is the right thing to do?We should probably add some documentation about how to do this.
The text was updated successfully, but these errors were encountered: