fromFunctionPointer static method

ObjCBlock<NSView Function(NSTableView, Long, Pointer<ObjCObject>)> fromFunctionPointer(
  1. Pointer<NativeFunction<Pointer<ObjCObject> Function(Pointer<ObjCObject> arg0, NSInteger arg1, Pointer<ObjCObject> arg2)>> 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

static objc.ObjCBlock<
  NSView Function(NSTableView, ffi.Long, ffi.Pointer<objc.ObjCObject>)
>
fromFunctionPointer(
  ffi.Pointer<
    ffi.NativeFunction<
      ffi.Pointer<objc.ObjCObject> Function(
        ffi.Pointer<objc.ObjCObject> arg0,
        NSInteger arg1,
        ffi.Pointer<objc.ObjCObject> arg2,
      )
    >
  >
  ptr,
) =>
    objc.ObjCBlock<
      NSView Function(NSTableView, ffi.Long, ffi.Pointer<objc.ObjCObject>)
    >(
      objc.newPointerBlock(
        _ObjCBlock_NSView_NSTableView_NSInteger_objcObjCObject_fnPtrCallable,
        ptr.cast(),
      ),
      retain: false,
      release: true,
    );