Skip to content

A set of helpers for resolving file names and paths of dynamic libraries.

License

Notifications You must be signed in to change notification settings

jpnurmi/dylib.dart

Repository files navigation

dylib

pub license: MIT build codecov

A set of helpers for resolving file names and paths of dynamic libraries.

Platform Name
Android libfoo.so
iOS libfoo.dylib
Linux libfoo.so
macOS libfoo.dylib
Windows foo.dll

Usage

A simple usage example:

import 'package:dylib/dylib.dart';

import 'foo_bindings.dart'; // LibFoo generated by ffigen, for example

LibFoo get libfoo {
  return _libfoo ??= LibFoo(ffi.DynamicLibrary.open(
    resolveDylibPath(
      'foo', // foo.dll vs. libfoo.so vs. libfoo.dylib
      dartDefine: 'LIBFOO_PATH',
      environmentVariable: 'LIBFOO_PATH',
    ),
  ));
}

void main() {
  libfoo.bar();
}

About

A set of helpers for resolving file names and paths of dynamic libraries.

Topics

Resources

License

Stars

Watchers

Forks

Languages