ffi_tool 0.1.0 copy "ffi_tool: ^0.1.0" to clipboard
ffi_tool: ^0.1.0 copied to clipboard

discontinued
outdated

Generates 'dart:ffi' bindings for C and Objective-C libraries.

Overview #

Pub Package GitHub Actions status

This library helps developers to generate dart:ffi bindings.

When you generate bindings for an iOS / Mac OS X library that uses the reference counting, the generated bindings will use cupertino_ffi.

Contributing #

Getting started #

Add dependency #

In "pubspec.yaml":

dev_dependencies:
  ffi_tool: ^0.1.0

Run pub get.

Write a script #

Create a generator script in some file (example: "tool/generate_ffi.dart"):

import 'package:ffi_tool/c.dart';
import 'dart:io';

void main() {
  generateFile(File("lib/src/generated.dart"), library);
}

final library = Library(
  dynamicLibraryIdentifier: "dlForExampleLibrary",
  dynamicLibraryPath: "path/to/library",
  importedUris: [
    "package:ffi/ffi.dart",
  ],
  elements: <Element>[
    // C function
    Func(
      name: "Example",
      parameterTypes: ["Int32", "Floa64", "*void", "void"],
      returnType: "ReturnType",
    ),

    // C global variable
    Global(
      name: "ExampleGlobal",
      type: "Int32",
    ),
  ],
);

Run it #

pub run tool/generate_ffi.dart
9
likes
0
pub points
6%
popularity

Publisher

unverified uploader

Generates 'dart:ffi' bindings for C and Objective-C libraries.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

meta

More

Packages that depend on ffi_tool