lookupFunction<T extends Function, F extends Function> method
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});