Medius - BindingsInstall

Install

No build step, works in C and C++

The binding is one header (medius.h) and one prebuilt library (libmedius_capi). It's the same for C and C++. The header compiles as both, so a C++ program #includes it and calls the same functions. Nothing to build, no Rust needed.

Download

The release archive for your platform

On the Releases page, download the file that matches your computer, then unzip it.

Your computerFile to download
Windows (64-bit)medius-capi-x86_64-pc-windows-msvc.tar.gz
macOS (Apple Silicon, M1+)medius-capi-aarch64-apple-darwin.tar.gz
macOS (Intel)medius-capi-x86_64-apple-darwin.tar.gz
Linux (Intel/AMD 64-bit)medius-capi-x86_64-unknown-linux-gnu.tar.gz
Linux (ARM64)medius-capi-aarch64-unknown-linux-gnu.tar.gz

Inside are two folders:

medius-capi-<your-platform>/
├── include/
│   └── medius.h
└── lib/
    └── libmedius_capi      (.so Linux · .dylib macOS · .dll + .lib Windows · .a static)

include/ holds the header you #include; lib/ holds the library you link.

Build & run

Compiler and linker flags
WINDOWS · VISUAL STUDIO

In your project's Properties (use the same values for C and C++):

  1. Under C/C++ → General → Additional Include Directories, add the unzipped include\ folder.
  2. Under Linker → General → Additional Library Directories, add the lib\ folder.
  3. Under Linker → Input → Additional Dependencies, add medius_capi.dll.lib.
  4. Copy medius_capi.dll next to your built .exe (or onto your PATH).

Build and run as normal. To skip the DLL, add medius_capi.lib in step 3 instead (static, nothing to copy).

WINDOWS · COMMAND LINE (x64 Native Tools Command Prompt)
cl app.c /I include /link /LIBPATH:lib medius_capi.dll.lib
:: C++:  cl /std:c++17 app.cpp /I include /link /LIBPATH:lib medius_capi.dll.lib
:: then copy medius_capi.dll next to app.exe, and run:
app.exe
LINUX & MACOS
# C
cc  app.c   -I include -L lib -lmedius_capi -o app
# C++ (same header, same library)
g++ -std=c++17 app.cpp -I include -L lib -lmedius_capi -o app

# run (tell the loader where the library is)
LD_LIBRARY_PATH=lib ./app        # macOS: DYLD_LIBRARY_PATH=lib ./app

On Linux add -lpthread. To avoid setting a path at run time, link the static libmedius_capi.a instead.

If your platform isn't listed, build it once: install the Rust toolchain, git clone https://github.com/K4HVH/medius, then cargo build -p medius-capi --release. The library lands in target/release/ and the header is medius-capi/include/medius.h. See Build & features.

Verify

Version print, no box needed

medius_version_string and medius_abi_version are pure library calls. If this builds and prints a version, you're set.

// app.c
#include <stdio.h>
#include <medius.h>

int main(void) {
    printf("%s, abi %u\n", medius_version_string(), medius_abi_version());
    return 0;
}

A linker error (cannot find -lmedius_capi / unresolved external) means the library directory is wrong. A crash on start (cannot open shared object / a missing-DLL popup) means the loader can't find the library at run time. Fix the path or copy the file next to your program. More on Build & features.

Connect

Open a box, read its version

medius_device_find opens the first box it sees and runs the handshake; medius_device_free closes it. Full walk-through on First program.

MediusDevice *dev = NULL;
if (medius_device_find(&dev) != MEDIUS_STATUS_OK) { /* see Calls & errors */ }

MediusVersion v;
medius_device_query_version(dev, &v);
printf("firmware %u.%u.%u\n", v.fw_major, v.fw_minor, v.fw_patch);

medius_device_free(dev);

Every call returns a MediusStatus you check; reading the failure text is on Calls & errors. The full call list is the API index.