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).
Questions tagged [dart-ffi]
109 questions
0
votes
1 answer
Sending c++ byte data using ffi to flutter
I used this code in this link to take a screenshot of the screen using GdiPlus and convert the bitmap to png bytes.
#include
#include
#include
#include
#include
bool save_png_memory(HBITMAP…

Kumah Andrews
- 21
- 8
0
votes
0 answers
FLUTTER WINDOWS -- How to import 3rd party Library to flutter
I want to make a windows application with flutter. But my app dependence with 3rd sdk
Please help me how to add *.lib to my project

IT DEV
- 11
- 2
0
votes
1 answer
Use a compiled dart executable as DynamicLibrary in Flutter
Since a longer time now it is possible to open a DynamicLibrary (dylib, dll, so) in Flutter. Those libraries are written in C or C++.
I've now tried to build a basic dart command line application, compiled it using dart compile exe and tried to load…

BEAGLE ENTERTAIN
- 158
- 2
- 9
0
votes
1 answer
Undefined reference while compiling Flutter app on Linux
I built a plugin which uses Dart FFI and a shared lib and published to pub.dev. Whenever I try using the plugin in my app, it always fails with a file not found error and I don't know where the error is coming from.
Error:
[ ] [ ]…

Frank nike
- 330
- 5
- 12
0
votes
0 answers
Cmake fail to compile cant find python.h (Flutter, dart:ffi)
I need to connect .C/.CPP code that makes use of Python in to Flutter app.
Luckily I can use dart:ffi for it. and therefore the
but when I'm trying to compile the apk I am getting the following error:
Launching lib/main.dart on AOSP on IA…

ET_DDE12
- 1
0
votes
1 answer
How to acess the result from a function pointer in dart
I am trying to get the return value from c++ function in dart.
My c++ code is something like this
static bool is_alive() {
return true;
}
From dart, I loaded the shared lib with this native code and I am trying to call that is_alive()…

jgm
- 1,230
- 1
- 19
- 39
0
votes
1 answer
CMake is not making makefile
I am trying to create dynamic library in windows. I followed the instruction in dart-ffi.
This is my CMakelists.txt
cmake_minimum_required(VERSION 3.20.2 FATAL_ERROR)
project(libgit VERSION 1.0.0 LANGUAGES C)
add_library(libgit SHARED…

Nivekithan
- 953
- 1
- 6
- 10
0
votes
1 answer
dart:ffi for NSURLSession
Is it possible to access NSURLSession and related types via FFI from dart? I would like to use this bindings with Flutter on iOS.
If yes, could that be done with dart:ffigen and how would I have to configure it? There are lots of samples for ffi,…

delixfe
- 2,471
- 1
- 21
- 35
0
votes
1 answer
win32 plugin build error in flutter_openvpn with Flutter 2.0 / Dart 12
I get this error when I build the app for iOS: Command PhaseScriptExecution failed with a nonzero exit code.
Screenshot of the build error in Xcode

Yacino
- 1
- 1
0
votes
0 answers
How to use dart:ffi in Flutter?
I'm stuck on how I would implement dart::ffi in Flutter, specifically the hello_world example.
Starting with the basic flutter create project (and an already compiled hello_world.dll) just trying:
void main() {
final dylib =…

Jonathan Woollett-light
- 2,813
- 5
- 30
- 58
0
votes
1 answer
Flutter generateJsonModelDebug while using ffi contained library
I want to use flutter library that contains dart FFI for performance.
Library name is bitmap and document says nothing special setting required to use.
So I added bitmap: ^0.0.6 to pubspec.yaml and build it.
But build error came out and it…

seung min
- 125
- 1
- 12
0
votes
1 answer
Dart _psapi not found
I am trying to call WinAPI. I have copy-past code from docs:
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:win32/win32.dart';
main() {
int EnumProcesses(
Pointer lpidProcess, int cb, Pointer lpcbNeeded)…

Dmitry Bubnenkov
- 9,415
- 19
- 85
- 145
0
votes
1 answer
Dart ffi - Reading emojis from file with C
I am saving a File with UTF-8 encoding which contains some information including a name for a button from Dart side with the following code:
file.writeAsString([
name.length.toString(),
name + Constants.nativeFileDelimeter,
…

cs guy
- 926
- 2
- 13
- 33
0
votes
0 answers
Showing detailed dumps
Hi i'm experimenting with dart ffi and i'm having an issue with the following dump
===== CRASH =====
si_signo=Segmentation fault(11), si_code=1, si_addr=(nil)
version=2.12.0-157.0.dev (dev) (Wed Dec 16 01:04:40 2020 -0800) on…

kignwill101
- 133
- 5
0
votes
0 answers
IOS dylib entry points
We are experimenting with Dart ffi (foreign function interface) and are looking to directly call into the IOS AVFoundation dylib from dart.
To use ffi we need to dynamically load the AVFoundation dylib.
These leads to several questions.
how do we…

Brett Sutton
- 3,900
- 2
- 28
- 53