Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I load a C dynamic library for FFI by specifying path in flutter?

I want to load a C Dynamic Library in flutter, how can I specify the path, and open it? is it possible to add .so file to the asset folder?

final dynamicLibrary = DynamicLibrary.open(libraryPath);

final Pointer<Utf8> Function() _someMethod = dynamicLibrary
    .lookup<NativeFunction<Pointer<Utf8> Function()>>(
      'native_some_method',
    )
    .asFunction();
like image 980
Hamed Avatar asked Oct 24 '25 14:10

Hamed


1 Answers

No, you can't, Because Android has multiple system kernels for example X86, X86-32 etc. If you add some .so (shared library) under the asset folder maybe you can use just one simulator. That's the way .c or .cpp files should compile with Android NDK.

like image 66
Hakan Turğay Avatar answered Oct 26 '25 05:10

Hakan Turğay