
This directory contains the public C ABI for the open-source COPP library. It focuses on using COPP from C through stable headers, ordinary C data types, and explicit ownership rules.
The C ABI is in its feedback and stabilization phase. It is intended to be usable today, but function names, problem descriptors, result structs, and packaging details may still evolve before the first stable C release. Feedback from downstream bindings, robotics applications, and packaging workflows is welcome. For C ABI questions, packaging feedback, compatibility requests, COPP PRO licensing, or commercial collaboration, please contact us at [email protected].
Open-source / Pro note: this README documents the open-source C ABI. For the full project overview, open-source vs Pro algorithm matrix, solver-selection guidance, benchmark comparisons, citation information, and collaboration contact details, see the COPP repository README.
The C API follows a deliberately small set of rules:
The algorithmic background, open-source algorithm availability, benchmark tables, and citation information live in the COPP repository README. This page focuses on building, linking, installing, and using the C ABI.
| Problem class | Public C API |
|---|---|
| Core utilities | status, last error, slices, matrix views, owned vectors/matrices |
| Path | waypoint spline paths, evaluator paths, metadata, 2nd/3rd derivative evaluation |
| Robot | station grids, path sampling, raw constraints, axial limits, inverse dynamics callback |
| TOPP2 | TOPP2-RA, ReachSet2, 2nd-order interpolation |
| COPP2 | COPP2-SOCP |
| TOPP3 | TOPP3-LP, TOPP3-SOCP, 3rd-order interpolation |
| COPP3 | COPP3-SOCP |
Runnable examples are in examples. They are built as CMake targets named example_*.
Prebuilt C ABI SDK packages for the latest tagged release are attached to the repository's GitHub Releases. If you want to build COPP from source instead, follow the steps below. The C ABI is behind Cargo's c feature, so source builds must enable it explicitly.
You need:
Install cbindgen once:
Run from the repository root:
Cargo produces the C ABI libraries under:
Typical artifact names are:
| Platform | Dynamic | Static |
|---|---|---|
| Windows | copp.dll + copp.dll.lib | copp.lib |
| Linux | libcopp.so | libcopp.a |
| macOS | libcopp.dylib | libcopp.a |
The public C symbols and headers use the copp prefix.
Headers are generated from the feature-gated src/ffi/c declarations and split into:
Windows:
Linux / macOS:
The checked-in headers can be used directly when you do not need to regenerate them.
Dynamic linking:
Static linking:
Run C tests:
Register examples as CTest tests:
Build one example target:
Disable tests or examples when configuring:
The CMake install step copies public headers, the native library, and a package config. Build the native library first with:
The installed layout is:
Dynamic install:
Static install:
Example prefixes:
Downstream projects can then use:
Configure the downstream project with:
On Windows with dynamic linking, the package target records both the import library and the runtime DLL. The DLL still needs to be next to the executable or visible through PATH at run time.
For static packages, the exported copp::copp target includes common platform native libraries. If a platform or toolchain needs extra native libraries, configure COPP with:
The optional install test installs COPP into a temporary prefix, configures a tiny downstream project with find_package(copp CONFIG REQUIRED), builds it, and runs it.
Dynamic package test:
Static package test:
Most C examples follow the same shape:
The C API intentionally avoids implementation-specific lifetimes, generics, closures, and builders. Problem structs are borrowed descriptors used only during the solver call.
Most C ABI functions return enum CoppStatus. COPP_STATUS_OK means success; other values are stable machine-readable failure classes.
Use copp_status_message(status) for a short static description. For detailed call-specific diagnostics, use the thread-local last-error API:
Successful C ABI calls clear the thread-local last-error slot. Failed calls set it to a UTF-8 message capped at 64 KiB. The pointer returned by copp_last_error_message() is owned by COPP and remains valid until the next COPP C ABI call on the same thread updates or clears it.
Wrappers that need ownership should copy the message:
Callbacks can attach details before returning an error:
The C API reference is generated from the public headers under:
Install Doxygen:
Windows:
Ubuntu / Debian:
macOS:
Generate docs:
Windows:
Linux / macOS:
Open:
The generated bindings/c/docs/ directory is ignored by Git.
| Header | Contents |
|---|---|
| copp/copp.h | Umbrella header |
| copp/core.h | status, last error, matrices, vectors, Clarabel options |
| copp/path.h | path handles and path evaluation |
| copp/robot.h | robot handles, sampling, constraints, callbacks |
| copp/formulation.h | problem descriptors, objectives, profiles |
| copp/interpolation.h | 2nd/3rd-order interpolation utilities |
| copp/topp2.h | TOPP2-RA and ReachSet2 |
| copp/copp2.h | COPP2-SOCP |
| copp/topp3.h | TOPP3-LP and TOPP3-SOCP |
| copp/copp3.h | COPP3-SOCP |
Example sources:
Available example targets:
Algorithms not listed in the open-source availability table in the COPP repository README are not documented as part of the open-source C ABI.
Install cbindgen, then run the header generation command from the repository root. If you do not need to change the ABI, use the checked-in headers.
Run:
The source-tree CMake flow expects the native library artifact under target/release/.
Make sure the downstream project sees the install prefix:
For dynamic linking, ensure copp.dll is next to your executable or visible through PATH.
Pass additional native libraries through: