ObjCBlock_ffiVoid.fromFunctionPointer constructor

ObjCBlock_ffiVoid.fromFunctionPointer(
  1. ThermionDartTexture1 lib,
  2. Pointer<NativeFunction<Void Function()>> ptr
)

Creates a block from a C function pointer.

This block must be invoked by native code running on the same thread as the isolate that registered it. Invoking the block on the wrong thread will result in a crash.

Implementation

ObjCBlock_ffiVoid.fromFunctionPointer(ThermionDartTexture1 lib,
    ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> ptr)
    : this._(
          lib._newBlock1(
              _cFuncTrampoline ??= ffi.Pointer.fromFunction<
                          ffi.Void Function(ffi.Pointer<_ObjCBlock>)>(
                      _ObjCBlock_ffiVoid_fnPtrTrampoline)
                  .cast(),
              ptr.cast()),
          lib);