![Latest Version] ![docs] ![MIT]

Interoptopus

🦀 → 🐙 → Python, C#, C, ...

FFI bindings to your favorite language. Composable. Explicit. Escape hatches included.

Overview

If you ...

... then Interoptopus might be for you.

Known limitations

Example & Backends

Assume you have written this Rust FFI code:

```rust use interoptopus::{ffifunction, ffitype};

[ffi_type]

[repr(C)]

pub struct Vec3f32 { pub x: f32, pub y: f32, pub z: f32, }

[ffi_function]

[no_mangle]

pub extern "C" fn mygamefunction(input: Option<&Vec3f32>) -> Vec3f32 { Vec3f32 { x: 2.0, y: 4.0, z: 6.0 } }

interoptopus::inventoryfunction!(ffiinventory, [], [mygamefunction], []); ```

You can now use one of these backends to generate interop code:

| Language | Crate | Sample Output | Comment | | --- | --- | --- | --- | | C# (incl. Unity) | interoptopusbackendcsharp | Interop.cs | Built-in. | | C | interoptopusbackendc | myheader.h | Built-in.| | Python CFFI | interoptopusbackendcpythoncffi | reference.py | Built-in. | | Your language | Write your own backend! | - | See existing backends. |

Features

See the reference project for a list of all supported features.

Current Status

FAQ

Contributing

PRs are welcome.