<!-- Source: https://medius.k4tech.net/bindings -->
# Bindings

_Drive the box from C, C++, or Python_

A [medius box](/native/hardware.md) sits inline between a mouse and a PC: the real device passes through untouched, and your program [injects input](/native/injection.md) of its own over a [USB-serial link](/native/frame.md). These bindings let you write that program in [C / C++](/bindings/c.md) or [Python](/bindings/python.md) instead of [Rust](https://crates.io/crates/medius). They cover the whole feature set and put the exact same bytes on the wire.

```
        your program   ( C / C++ / Python )
                       │
        ┌──────────────▼──────────────┐
        │      language binding       │   ◀ these pages
        └──────────────┬──────────────┘
                       │   C ABI · medius.h + libmedius_capi
        ┌──────────────▼──────────────┐
        │     medius (Rust core)      │   ◀ the client library
        └──────────────┬──────────────┘
                       │   4 Mbaud USB-serial frames
        ┌──────────────▼──────────────┐
        │       the medius box        │   ▶ mouse + game PC
        └─────────────────────────────┘
```

> **Note**
>
> C and C++ are one binding: the C header ([`medius.h`](/bindings/c.md)) compiles as both, so a C++ program includes it and calls the same functions. If you're new to medius, start with the [Quickstart](/native/quickstart.md) for what the box does; these pages link to the [Rust Library](/library.md) and [Native API](/native.md) for what each command means.

## Languages

_Same capabilities, different ergonomics_

| Language | Install | Errors | Cleanup | Reach for it when |
| --- | --- | --- | --- | --- |
| [`Python`](/bindings/python.md) | `[pip](https://pip.pypa.io) install medius` | raises [`MediusError`](/bindings/python/types.md#errors) | automatic (`[with](https://docs.python.org/3/reference/datamodel.html#context-managers)` / [GC](https://docs.python.org/3/glossary.html#term-garbage-collection)) | scripting, automation, fast prototyping |
| [`C / C++`](/bindings/c.md) | download the prebuilt library | returns [`MediusStatus`](/bindings/c/types.md#errors) | manual ([`*_free`](/bindings/c/api.md)) | a C or C++ app, embedding, a base for another [FFI](https://en.wikipedia.org/wiki/Foreign_function_interface) |

## Coverage

_Every box feature, in every language_

| Capability | C / C++ | Python |
| --- | --- | --- |
| [Connect, find, clone the link](/library/connection.md) | ✓ | ✓ |
| [Move & wheel](/library/move.md) | ✓ | ✓ |
| [Inject buttons, keys, media](/library/inject.md) | ✓ | ✓ |
| [Lock physical input](/library/lock.md) | ✓ | ✓ |
| [Catch live input (streams)](/library/catch.md) | ✓ | ✓ |
| [Buffered clip playback](/library/clip.md) | ✓ | ✓ |
| [Options & LED](/library/options.md) | ✓ | ✓ |
| [Queries (version, health, caps…)](/library/requests.md) | ✓ | ✓ |
| [Mock box (testing)](/library/features/mock.md) | build flag | build flag |
| [Flash firmware](/library/features/flash.md) | build flag | build flag |
| [Async](/library/features/async.md) | sync only. Build it on the stream timeouts (see each Streams page) | sync only. Build it on the stream timeouts (see each Streams page) |

Mock and flash are off by default; each binding's **Build & features** page shows how to turn them on.
