Davenchy / libtorrent-dart-bindings-example

A simple example on how to write libtorrent bindings for dart lang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LibTorrent Dart Bindings Example

Introduction

Hello there! Welcome to this example project demonstrating how to create LibTorrent bindings for the Dart language. I hope you find it helpful and informative.

Output Example

Why??

Everything started from here dart-lang/native#218

Requirements

Before diving in, make sure you have the following prerequisites installed:

  • Ensure libtorrent shared library is installed on your system and recognized by the compiler using the flag -ltorrent-rasterbar.
  • If you have libtorrent source files in a custom path, update the wrapper/Makefile accordingly.
  • You'll also need to have the Dart SDK installed.

Makefile

  • The wrapper/Makefile contains various useful rules to streamline the development process:
  1. debug: Builds a test binary with gdb flag enabled for testing/debugging process.
  2. run: Similar to debug, but it also runs the binary after building.
  3. build: This rule is responsible for building the wrapper library: libwrapper.so by default.

Build the Wrapper Library

  • To build the wrapper library, execute the following command:
make build

Run the Example Project

Once you've built the wrapper library, follow these steps to run the example project:

  1. Copy the library file libwrapper.so into the Dart project directory.
  2. Get dart packages
dart pub get
  1. Run the project using the following command:
dart run

Additional Resources

If you want to dive deeper into LibTorrent, here are some helpful resources:

LibTorrent Documentation

Dart FFI

StackOverflow

Other

Contribution

Feel free to fork this project or create pull requests if you'd like to contribute. Your feedback and contributions are highly appreciated!

About

A simple example on how to write libtorrent bindings for dart lang


Languages

Language:C++ 55.6%Language:Dart 39.9%Language:Makefile 4.5%