Skip to main content

Bytes. Distributed. For all languages.

Project description

iroh-ffi

Foreign Function Interface (FFI) bindings for Iroh

This repo defines Python & Swift bindings for iroh, which is written in Rust.

Published Packages:

Python Swift

Planned Support:

We're hoping to ship support for the following langauges in the future

  • Kotlin

Library Compilation

Running cargo build --release will produce a dynamic library and a static library.

For builds targeting older versions of MacOS, build with with: MACOSX_DEPLOYMENT_TARGET=10.7 && cargo build --target x86_64-apple-darwin --release.

Swift

Xcode and IOS

  • Run make.sh.
  • Add IrohLib as a local package dependency under Frameworks, Libraries, and Embedded Content in the General settings of your project.
  • Run Build
  • Check that it is now listed under Frameworks, Libraries, and Embedded Content, if not click + again and add it from the list.
  • Add SystemConfiguration as a Framework.
  • Now you can just import the library in Swift with a standard import statement like import IrohLib.

Python

  • Install maturin for python development and packaging.
  • Install uniffi-bindgen with pip
  • maturin develop will build your package

Building wheels

Invoking maturin build will build a wheel in target/wheels. This will likely only work on your specific platform. To build a portable wheel for linux use:

docker run --rm -v $(pwd):/mnt -w /mnt quay.io/pypa/manylinux2014_x86_64 /mnt/build-wheel.sh

Go

Running

To make sure everything go needs to find is included the following is needed

LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}:<binaries path>" \
CGO_LDFLAGS="-liroh -L <binaries path>" \
go <actual go command to build or run>

where <binaries path needs to be replaced with the absolute path to where the rust build output is. Eg /<path to repo>/iroh-ffi/target/debug in debug mode.

Updating the bindings

Install uniffi-bindgen-go:

cargo install uniffi-bindgen-go --git https://github.com/dignifiedquire/uniffi-bindgen-go --branch upgarde-uniffi-24

Development

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

iroh-0.2.0-py3-none-win_amd64.whl (8.0 MB view hashes)

Uploaded Python 3 Windows x86-64

iroh-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.1 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

iroh-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (12.0 MB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

iroh-0.2.0-py3-none-macosx_11_0_arm64.whl (8.9 MB view hashes)

Uploaded Python 3 macOS 11.0+ ARM64

iroh-0.2.0-py3-none-macosx_10_7_x86_64.whl (9.4 MB view hashes)

Uploaded Python 3 macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page