[go: nahoru, domu]

Skip to content

Latest commit

 

History

History

ffi

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Dart FFI Samples

A series of simple examples demonstrating how to call C libraries from Dart.

This code is designed to work with Dart version 2.12.0 and above.

To learn more about FFI, start with the C interop using dart:ffi guide on dart.dev.

Building native libraries

Each sample uses CMake to generate a Makefile. To build the native library for each sample:

cd hello_world/hello_library
cmake .
make

The make command creates a libhello.dylib (macOS), libhello.dll (Windows) or libhello.so (Linux) library file.

Running

Once the native library is built, run:

dart pub get
dart run <filename>.dart

macOS code signing

The Dart binary can only load shared libraries that are signed. For more information, see dart-lang/sdk/issues/38314 for details.