Dart FFI vs Java library linking

813 Views Asked by At

It's unclear how Dart VM loads a C/C++ library through FFI.

final dylib = ffi.DynamicLibrary.open(libraryPath);

Some C++ libraries require a java context to work on Android. For example, Juce library is initialized through

public class Java
{
    static
    {
        System.loadLibrary ("juce_jni");
    }

    public native static void initialiseJUCE (Context appContext);
}

However, if I want to call Juce from Dart using FFI, I cannot load it from Dart as I'd not be able to pass a java context. If I load the library from Java, then I cannot use Dart FFI.

Is there a way to load the same lib in Java and Dart, start it in Java but then interface it with Dart FFI?

0

There are 0 best solutions below