Function allo_isolate::store_dart_post_cobject
source · #[no_mangle]
pub unsafe extern "C" fn store_dart_post_cobject(
ptr: DartPostCObjectFnType
)
Expand description
Stores the function pointer of Dart_PostCObject
, this only should be
called once at the start up of the Dart/Flutter Application. it is exported
and marked as #[no_mangle]
.
you could use it from Dart as following:
Safety
This function should only be called once at the start up of the Dart application.
Example
import 'dart:ffi';
typedef dartPostCObject = Pointer Function(
Pointer<NativeFunction<Int8 Function(Int64,
Pointer<Dart_CObject>)>>);
// assumes that _dl is the `DynamicLibrary`
final storeDartPostCObject =
_dl.lookupFunction<dartPostCObject, dartPostCObject>(
'store_dart_post_cobject',
);
// then later call
storeDartPostCObject(NativeApi.postCObject);