Тёмный

Calling C/C++ from Flutter - Richard Heap (Flutter Week) 

Dev Café
Подписаться 12 тыс.
Просмотров 30 тыс.
50% 1

The Dart VM now supports calling C/C++ functions directly through the Foreign Function Interface (dart:ffi). Flutter uses the plugin project type to encapsulate the Dart interface abstraction together with the C/C++ source code, build instructions and a example app. Unlike normal plugins there's no Kotlin or Swift code. We’ll cover creating a dart:ffi plugin, using Xcode or Android Studio to view and edit the C/C++, defining the Dart-C bindings and testing on iOS and Android.
GitHub link: github.com/richardheap/libres...

Наука

Опубликовано:

 

19 апр 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 14   
@wile9763
@wile9763 2 года назад
Just want to clarify that is possible to call Rust code using FFI if it exposes a function using "extern C", i.e. it generates a C-like symbol in the final library.
@facundofarall7716
@facundofarall7716 4 года назад
Great video! Very well explained how ffi works, and specially since there aren't that many out there. One question though, what about the implementation of the write() method? I couldn't find it in the video
@stevenbense3504
@stevenbense3504 4 года назад
Thank you for this well explained demonstration. There are many difficulties when trying to do this in practice. I had this issue with the typedefs: This compiles fine as the lib.lookup to NativeFunction resolves typedef native_messagebus_dispose = Int8 Function(Pointer); typedef dart_messagebus_dispose = int Function(Pointer); _messagedispose = myLib.lookup('messagebus_dispose') .asFunction(); however this does not resolve typedef native_messagebus_dispose = Void Function(Pointer); typedef dart_messagebus_dispose = Void Function(Pointer); How to resolve such method types?
@rlheap
@rlheap 4 года назад
I think the second typedef would have to be void Function(Pointer) - note the lower case v of the return type on the dart version.
@erikjohnson9112
@erikjohnson9112 3 года назад
Checkout FFIgen. It is an open source project for creating the bindings for you by processing C header files. Works well for me.
@thefamousdjx
@thefamousdjx 2 года назад
Does this work for flutter desktop too?
@kirill4531
@kirill4531 3 года назад
callbacks are also supported: github.com/dart-lang/sdk/issues/34452#issuecomment-638666612
@lofto8363
@lofto8363 9 месяцев назад
i'm trying to build flutter linux desktop application that with opening camera and taking picture functionalities. I wrote my native code that is working fine if i run itself without dart. it is not working at all when i integrate it. Is it even possible to build it?
@homeroni
@homeroni 2 года назад
can you do ffi for web with webassembly?
@hatemsaad3421
@hatemsaad3421 3 года назад
9:48
@MdMubin-bp7wp
@MdMubin-bp7wp 3 года назад
I have a source code of an application written in .cpp... I want to call it's function from Dart. .but I can't! !! 😢😢😢
Далее
What is happening with Flutter
3:41
Просмотров 142 тыс.
Flutter for iOS developers
13:43
Просмотров 104 тыс.
Хотите поиграть в такую?😄
00:16
Просмотров 375 тыс.
BEST WAY to make Desktop Applications in C++
26:00
Просмотров 891 тыс.
Don't throw exceptions in C#. Do this instead
18:13
Просмотров 252 тыс.
Dart FFI With Rust by Muhammed Salih Guler
20:16
Is it worth learning Flutter in 2024?
10:57
Просмотров 13 тыс.
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
Просмотров 872 тыс.
Why you should learn Flutter in 2023
9:31
Просмотров 268 тыс.
How to make cross-platform games/apps in C++
6:01
Просмотров 13 тыс.
Isolates in Flutter | Simplified
10:28
Просмотров 22 тыс.
Как работает экосистема Apple?
18:08