Spec-Zone.ru › Dart 2

dart:ffi

lookupFunction<T extends Function, F extends Function> method

F lookupFunction<T extends Function, F extends Function>(
  1. String symbolName,
  2. {bool isLeaf = false}
)

Looks up a native function and returns it as a Dart function.

T is the C function signature, and F is the Dart function signature.

isLeaf specifies whether the function is a leaf function. A leaf function must not run Dart code or call back into the Dart VM. Leaf calls are faster than non-leaf calls.

For example:

int32_t add(int32_t a, int32_t b) {
  return a + b;
}
DynamicLibrary dylib = DynamicLibrary.executable();
final add = dylib.lookupFunction<Int32 Function(Int32, Int32), int Function(int, int)>(
        'add');

Implementation

external F lookupFunction<T extends Function, F extends Function>(
    String symbolName,
    {bool isLeaf = false});

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-ffi/DynamicLibraryExtension/lookupFunction.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API