Тёмный

C interoperability with Dart FFI | Session 

Flutter
Подписаться 573 тыс.
Просмотров 26 тыс.
50% 1

Learn the basics of Dart FFI, including what it is, what you can use it for, and how it works. Experience a demonstration of wrapping the sqlite library with FFI, and learn how it's used to implement search in a Flutter app.
Resources:
Dart FFI documentation → goo.gle/2SfNgKF
Speakers: Daco Harkes, Michael Thomsen
Watch more:
Flutter at Google I/O 2021 Playlist → goo.gle/io21-Flutter
All Google I/O 2021 Technical Sessions → goo.gle/io21-technicalsessions
All Google I/O 2021 Sessions → goo.gle/io21-allsessions
Subscribe to Flutter! → goo.gle/FlutterYT
#GoogleIO #Flutter
product: Dart - General; event: Google I/O 2021; fullname: Daco Harkes, Michael Thomsen; re_ty: Premiere;

Наука

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

 

4 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 45   
@thomasmabika7291
@thomasmabika7291 3 года назад
finally some advanced stuff....!!
@ushieru
@ushieru 3 года назад
Thank you Daco and Prerak for the excellent job you do
@pauloperbone
@pauloperbone 3 года назад
This is amazing! Thanks for the hard work!
@mrunfunny
@mrunfunny 3 года назад
Thanks Daco and Prerak for ffigen. It really is an awesome library.
@soumyadipmondal9652
@soumyadipmondal9652 3 года назад
Seriously life saving :)
@ISKLEMMI
@ISKLEMMI 3 месяца назад
I found this overview quite useful! Thank you!
@jeff-oi7cl
@jeff-oi7cl 3 года назад
@5:00 LOL, acting is part of the job it seems, that guy knows more than the manager...
@michaelthomsen6857
@michaelthomsen6857 3 года назад
I'm really happy you noticed this. I thought it was a nice little joke :-)
@jeff-oi7cl
@jeff-oi7cl 3 года назад
@@michaelthomsen6857 I general, I think engineers deserve far more recognition (and salary while I'm at it) than hr and managers since they do all the hard work which can't be denied (even though at Google I heard luckily this is not the case). I hope this will change over the next few years. Somehow in 2021 it is still normal that managers and hr are still pressuring the engineers for their own gains.
@jeff-oi7cl
@jeff-oi7cl 3 года назад
@@michaelthomsen6857 It was definitely a nice joke, I'll give you that :)
@devbathani8020
@devbathani8020 5 месяцев назад
the way code is explained is pretty simple and easy to understand
@sensnsounds6924
@sensnsounds6924 3 года назад
Great! Is it possible to use Android 10 AMidi Api with Dart FFi in Flutter? I ask because there is some JNI involved in getting the MIDI devices from Java side. Thanks
@jafarrezazadeh846
@jafarrezazadeh846 2 года назад
Hi, how i can convert the .c file to .dylib file
@mmsti7867
@mmsti7867 Год назад
Can I use dart FFI for a C++,Qt project? If I use Android emulator on Windows then I use .so or .dll? If I have more than one .dll/.so file, how to deal with them?
@bobby9568
@bobby9568 Год назад
What kind of updates or changes have you performed as this video is now a year old?
@KLye1
@KLye1 3 года назад
is there anyway to declare native utf8 in Dart without calling the converter function?
@dacoharkes5984
@dacoharkes5984 3 года назад
Sorry no, currently the only way is to use the toUtf8 function. Dart strings are UTF16 [1], and Dart strings can be moved by the Dart garbage collector. [1] api.dart.dev/dart-core/String-class.html
@anhquannguyen8190
@anhquannguyen8190 3 года назад
The video is 13:37 in length
@dasaintgray
@dasaintgray Год назад
It is possible to load 32bit DLL dart:ffi?
@AbhishekSharma-qt9ii
@AbhishekSharma-qt9ii 2 месяца назад
I am unable to use .dylib file in my flutter project without adding file via Xcode if I added .dylib via Xcode then working on macOS otherwise not. but working on other OS(windows=.a and linux=.so) except macOS. do anyone have solution for it, I will be able to use .dylib file without using XCode?
@ahmed_samet
@ahmed_samet 2 года назад
I couldn't access the file (libutils.1.0.0.bylib)... Any help?
@AmrutNerlikar
@AmrutNerlikar Год назад
Amazing. Need Fuschia Things as a replacement for Android Things
@bennguyen1313
@bennguyen1313 Год назад
I'd like to use ffi/ffigen to make a Flutter Windows application that accesses peripherals connected to the desktop (usb, bluetooth, etc )! I have both 32-bit and 64-bit dlls that can access different hardware.. can flutter build/link with those dlls, and more importantly work when the dll functions are called? I did find a few older blog posts by Igor Kharakhordin, Nick Fisher , Majid Hajian , Marvin Sanchez (Integrating C library in a desktop Flutter app using Dart FFI, using Dart FFI to access native libraries in Flutter , Calling Native Libraries in Flutter with Dart FFI, Port an existing C/C++ app to Flutter with Dart FFI) however they're based on Flutter 2.x.. would love to see a video on actually using flutter to access a desktop device!
@seetheworld3839
@seetheworld3839 Год назад
What about javascript function please i need something for it does anyone know about it
@Elite7555
@Elite7555 3 года назад
Though, it would be cool to not rely on _Pointer_ for arrays outside structs. Managing arrays is quite a pain point for now, not to say unsafe.
@magacaygamaxamuud7253
@magacaygamaxamuud7253 Год назад
Can I use this to call c++ opengl
@manishgautam2424
@manishgautam2424 Год назад
Can't load , but have to create a separate plugins and then it starts working
@huseinnashr
@huseinnashr 4 месяца назад
please add ffi to web wasm build 🙏
@xerzes5900
@xerzes5900 3 года назад
bruh, Daco is legit an AI
@aliakram1145
@aliakram1145 Год назад
Looks nice, I am facing an issue whenever I give path like this final projLib = DynamicLibrary.open("../libs/dependencies/libproj.dylib"); I get error that failed: library "../libs/dependencies/libproj.dylib" not found
@gofudgeyourselves9024
@gofudgeyourselves9024 3 года назад
How about C++,Rust and golang?
@michaelthomsen6857
@michaelthomsen6857 3 года назад
FFI should work with any language that compiles to modules that follow the C calling convention. Here's a small example for Rust. Consider this Rust code: #[no_mangle] pub extern fn add(i: i32, j: i32) -> i32 { return i + j; } We compile it to a dynamic library: ``` $ rustc --crate-type=cdylib add.rs ``` And then call it with this Dart FFI code: import 'dart:ffi'; import 'dart:io'; import 'package:ffi/ffi.dart'; main() { final dylib = DynamicLibrary.open('libadd.dylib'); final add = dylib.lookupFunction('add'); print(add(40, 2)); }
@soumyadipmondal9652
@soumyadipmondal9652 3 года назад
C++ won't "directly" work due to name mangling (as far as I know). So, you can't really predict the function name. You can fix it using extern "C" to tell C++ compiler not to modify the name. Then you're all good to go. And, surely you can guess that function overloading won't work for name un-mangled functions :)
@prometheusli101
@prometheusli101 2 года назад
please make tutorial for Android
@diegocamilopenaramirez6101
@diegocamilopenaramirez6101 3 года назад
Can i access to the source code on the video?
@mesota2842
@mesota2842 3 года назад
Go to this timestamp: 11:20
@michaelthomsen6857
@michaelthomsen6857 3 года назад
Hi Diego, it's here: github.com/mit-mit/ffi-talk
@JeroenDeMaeijer
@JeroenDeMaeijer 4 месяца назад
@@michaelthomsen6857Source code is not working properly anymore (I am testing it under Windows). I had to add "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/Llvm/x64" as llvm-path in ffigen.yaml. Then the source gets generated with a lot of warnings, but the final result cannot be compiled in Android studio. I get errors like error: 'dynamic Function()' doesn't conform to the bound 'NativeType' of the type parameter 'T'. (type_argument_not_matching_bounds at [sqlite] lib\src\third_party\sqlite3\generated_bindings.dart:36) on the line ffi.Pointer arg0, ... etc etc.
@MdMubin-bp7wp
@MdMubin-bp7wp 3 года назад
How to create CMakeLists.txt and .dylib file?
@soumyadipmondal9652
@soumyadipmondal9652 3 года назад
.dylib is shared libraries for MacOS. And, CMakeLists.txt just contains compiling instructions of that dylib. You can compile your own .dylib/.DLL/.so using command line (gcc/g++/msvc etc) also. Or, you can use 3rd party libraries also if you know the function signatures.
@ShivamJha00
@ShivamJha00 3 года назад
By reading cmake documentation
@loop8836
@loop8836 3 года назад
Why would we need to call c++ code what are possibilities
@ThomazMartinez
@ThomazMartinez Год назад
Sorry guys but this fake pretending of scenario conversations is really weird please dont do this
@panchoyarco9804
@panchoyarco9804 2 года назад
Great job. Just an observation regarding the result of your recommended link: "131 packages for search query Note that sqlite (the first hit) says "DART 2 INCOMPATIBLE". A package that mentions "FFI" explicitly (and Null safety) is sqlite3. Lots of good effort. Congratulations and many thanks.
Далее
Why null safety? | Session
15:14
Просмотров 38 тыс.
Rethinking Dart interoperability with Android
16:02
Просмотров 15 тыс.
ЮТУБ ТОЧНО ВСЕ!
11:23
Просмотров 1 млн
Pragmatic State Management in Flutter (Google I/O'19)
33:25
Is C++ better than C?
1:46:10
Просмотров 43 тыс.
why do header files even exist?
10:53
Просмотров 383 тыс.
Learn to use Isolates in Flutter | Simplified
10:28
Просмотров 23 тыс.
When, why, and how to multithread in Flutter
15:10
Просмотров 62 тыс.