C interoperability with Dart FFI | Session

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024

ความคิดเห็น • 44

  • @thomasmabika7291
    @thomasmabika7291 3 ปีที่แล้ว +28

    finally some advanced stuff....!!

  • @mrunfunny
    @mrunfunny 3 ปีที่แล้ว +10

    Thanks Daco and Prerak for ffigen. It really is an awesome library.

  • @jeff-oi7cl
    @jeff-oi7cl 3 ปีที่แล้ว +12

    @5:00 LOL, acting is part of the job it seems, that guy knows more than the manager...

    • @michaelthomsen6857
      @michaelthomsen6857 3 ปีที่แล้ว +4

      I'm really happy you noticed this. I thought it was a nice little joke :-)

    • @jeff-oi7cl
      @jeff-oi7cl 3 ปีที่แล้ว +4

      @@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 ปีที่แล้ว +1

      @@michaelthomsen6857 It was definitely a nice joke, I'll give you that :)

  • @devbathani8020
    @devbathani8020 7 หลายเดือนก่อน

    the way code is explained is pretty simple and easy to understand

  • @pauloperbone
    @pauloperbone 3 ปีที่แล้ว +5

    This is amazing! Thanks for the hard work!

  • @ushieru
    @ushieru 3 ปีที่แล้ว +1

    Thank you Daco and Prerak for the excellent job you do

  • @ISKLEMMI
    @ISKLEMMI 5 หลายเดือนก่อน

    I found this overview quite useful! Thank you!

  • @anhquannguyen8190
    @anhquannguyen8190 3 ปีที่แล้ว +4

    The video is 13:37 in length

  • @jafarrezazadeh846
    @jafarrezazadeh846 2 ปีที่แล้ว +3

    Hi, how i can convert the .c file to .dylib file

  • @KLye1
    @KLye1 3 ปีที่แล้ว +4

    is there anyway to declare native utf8 in Dart without calling the converter function?

    • @dacoharkes5984
      @dacoharkes5984 3 ปีที่แล้ว +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

  • @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.

  • @xerzes5900
    @xerzes5900 3 ปีที่แล้ว +1

    bruh, Daco is legit an AI

  • @AmrutNerlikar
    @AmrutNerlikar 2 ปีที่แล้ว

    Amazing. Need Fuschia Things as a replacement for Android Things

  • @AbhishekSharma-qt9ii
    @AbhishekSharma-qt9ii 4 หลายเดือนก่อน

    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?

  • @huseinnashr
    @huseinnashr 6 หลายเดือนก่อน

    please add ffi to web wasm build 🙏

  • @manishgautam2424
    @manishgautam2424 ปีที่แล้ว

    Can't load , but have to create a separate plugins and then it starts working

  • @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!

  • @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

  • @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?

  • @seetheworld3839
    @seetheworld3839 ปีที่แล้ว

    What about javascript function please i need something for it does anyone know about it

  • @ahmed_samet
    @ahmed_samet 3 ปีที่แล้ว

    I couldn't access the file (libutils.1.0.0.bylib)... Any help?

  • @magacaygamaxamuud7253
    @magacaygamaxamuud7253 2 ปีที่แล้ว

    Can I use this to call c++ opengl

  • @dasaintgray
    @dasaintgray ปีที่แล้ว

    It is possible to load 32bit DLL dart:ffi?

  • @prometheusli101
    @prometheusli101 2 ปีที่แล้ว

    please make tutorial for Android

  • @MdMubin-bp7wp
    @MdMubin-bp7wp 3 ปีที่แล้ว +2

    How to create CMakeLists.txt and .dylib file?

    • @soumyadipmondal9652
      @soumyadipmondal9652 3 ปีที่แล้ว +1

      .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 ปีที่แล้ว +1

      By reading cmake documentation

  • @loop8836
    @loop8836 3 ปีที่แล้ว

    Why would we need to call c++ code what are possibilities

  • @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 ปีที่แล้ว +1

      Hi Diego, it's here: github.com/mit-mit/ffi-talk

    • @JeroenDeMaeijer
      @JeroenDeMaeijer 6 หลายเดือนก่อน

      @@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.

  • @ThomazMartinez
    @ThomazMartinez ปีที่แล้ว +2

    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.

  • @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 ปีที่แล้ว +1

    How about C++,Rust and golang?

    • @michaelthomsen6857
      @michaelthomsen6857 3 ปีที่แล้ว +10

      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 ปีที่แล้ว +2

      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 :)