Skip to content

src/flutter_slm_bridge.h

Functions

Name
FFI_PLUGIN_EXPORT int sum(int a, int b)
FFI_PLUGIN_EXPORT int sum_long_running(int a, int b)

Functions Documentation

function sum

FFI_PLUGIN_EXPORT int sum(
    int a,
    int b
)

function sum_long_running

FFI_PLUGIN_EXPORT int sum_long_running(
    int a,
    int b
)

Source code

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "os_defines.h"

// A very short-lived native function.
//
// For very short-lived functions, it is fine to call them on the main isolate.
// They will block the Dart execution while running the native function, so
// only do this for native functions which are guaranteed to be short-lived.
FFI_PLUGIN_EXPORT int sum(int a, int b);

// A longer lived native function, which occupies the thread calling it.
//
// Do not call these kind of native functions in the main isolate. They will
// block Dart execution. This will cause dropped frames in Flutter applications.
// Instead, call these native functions on a separate isolate.
FFI_PLUGIN_EXPORT int sum_long_running(int a, int b);

Updated on 2026-07-25 at 22:56:57 +0000