Questions tagged [dart-ffi]

Use this tag for questions about Dart's Foreign Function Interface (FFI) - the ability to call C directly from Dart. It is equally applicable to applications running in the Dart VM and to Flutter applications (except Flutter Web, of course).

109 questions
0
votes
0 answers

How to read audio metadata using TagLib with dart FFI

I am working on a cross-platform music player app with Flutter. I encounter a problem with reading audio metadata. I have found a package to read called Metadata God but it supports a few types of file formats. I need to support MP3, M4A, WMA, OGG,…
NattyPluz
  • 26
  • 3
0
votes
0 answers

how to call flutter function in C

i'm developing android/ios app with flutter. Even if you use flutter, there are many cases where you have to use native code. I found a way to call native code in flutter by referring to the official flutter documentation. That's…
Jungwon
  • 1,038
  • 7
  • 20
0
votes
0 answers

Flutter on Windows: Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'abc.dll': error code 193

I build a 'abc.dll', which is dependent on some other dll. add_library( abc SHARED mycode.cpp ) target_link_libraries( abc avutil-57 avformat-59 ) Then I run flutter build windows -v to build the project, and in Release folder…
John
  • 697
  • 1
  • 10
  • 33
0
votes
0 answers

Flutter FFI: Invalid argument(s): Failed to lookup symbol '...': error code 127

I created a fresh project using flutter create --platforms=android,ios,macos,linux,windows --template=plugin_ffi demo_ffi I depended on it in another flutter app and used the default shipped functions sum and sumAsync successfully without doing any…
HII
  • 3,420
  • 1
  • 14
  • 35
0
votes
1 answer

How to use .a file for iOS with Flutter FFI?

I have a rust project. Compiling it to .so for android, I'm able to run it with Android. I have also generated .a file for iOS and used instructions for this answer but it's throwing following error: Semantic Issue (Xcode): Use of undeclared…
Mohit Singh
  • 323
  • 4
  • 13
0
votes
0 answers

Call native code in flutter via DllExport

Hi I have several code on C# and I want call in on flutter. I add https://github.com/3F/DllExport to my C# project and create .dll. I checked this .dll in other C# project and in works. My code on C# { [DllExport("scanResult",…
Nikolay
  • 344
  • 1
  • 15
0
votes
0 answers

How to pass a callback to a win32 function with dart ffi?

I'm trying to connect to my MIDI device to a Flutter app running on Windows. I'm using win32 and dart ffi. I have the following: final Pointer hMidiDevice = malloc(); Pointer> callbackPointer = …
user4401
  • 394
  • 1
  • 4
  • 15
0
votes
2 answers

"Failed to lookup symbol: symbol not found" when running Flutter plugin with native iOS static library

I'm trying to get dart bindings for a static library to work on iOS. So far, I've gotten the plugin's example project to compile, but I get the following error when I try to use the native functions at runtime: Invalid argument(s): Failed to lookup…
James K
  • 1
  • 1
0
votes
0 answers

Cannot pass parameters Dart -> C++ using FFI

Friends I am calling a native C++ programme I have written from Dart. The problem I am having is that the parameters I am passing are not being received on the C++ side. I have a structure with a buffer pointer and two ints. A function that takes…
Wrog
  • 21
  • 5
0
votes
2 answers

Using a C++ DLL in Flutter The type must be a subtype

dll` to my flutter project In .dll I type function: int testdll(int param) { //... } on flutter I type this: final DynamicLibrary nativePointerTestLib = DynamicLibrary.open("assets/SimpleDllFlutter.dll"); final Int Function(Int arr) testdllflutter…
Nikolay
  • 344
  • 1
  • 15
0
votes
1 answer

FindWindowA function does not yield the expected output in dart foreign function interface

The following dart code's expected output is the handle to the file explorer window but the output always comes out to be 0 even though the file explorer window does exist! import 'package:ffi/ffi.dart'; import 'dart:ffi'; void main() { …
Sanmay Kant
  • 149
  • 8
0
votes
1 answer

Passing Future as a function pointer to C++ using dart:ffi

I want C++ code to execute a async function Future inside of C++ itself as a function pointer using dart:ffi. C++ code have to receive int value inside of C++ itself as result of Future. Also, I cannot avoid to use Future because this…
otsuka
  • 11
  • 4
0
votes
1 answer

Flutter / Dart FFI existing .so file for Android

I'm trying to use a pre-compiled .so file with Flutter/Dart FFI. I've generated bindings with dart-ffigen, which seems to work without any issues. I've added the following to the build.gradle file within the android block. externalNativeBuild { …
Jeroen
  • 260
  • 4
  • 14
0
votes
0 answers

Flutter ffi failed to open dynamic library

I'm trying to use the flutter ffi to port over my c/c++ code but it's unable to open the dynamic library it needs to be able to work(I'm on windows) import 'dart:ffi'; import 'dart:io' show Directory, Platform; import 'package:ffi/ffi.dart'; import…
0
votes
1 answer

Flutter: convert bitmap (e.g. screenshot) from clipboard to base64 string

This is my current requirement: A) The screenshot/bitmap in my clipboard must be pasted into the app (Platform: primarily Windows, but must run on all other platforms aswell: Android/iOS/Linux/MacOS/Web) I found out that Flutter does not support…
Marwin Lebensky
  • 270
  • 1
  • 2
  • 16