C+
Archived manual for C+ v0.0.18. Read the current manual (v0.0.30)
Packages · View as Markdown

Packages

C+ is C plus packages. The language core is small on purpose; capability comes from packages, including the standard library. stdlib is a vendored package like any other, not a language built-in.

How a package works

Every package is a directory under vendor/ with a Cplus.toml manifest, a <package-name>.cplus library entry, and in-package #[test] functions you can run with cd vendor/<pkg> && cpc test. To use one, add it to your manifest and import it:

[dependencies]
stdlib = "*"
json   = "*"
import "stdlib/io" as io;
import "json/json" as json;

The driver walks one directory up from your project to resolve sibling vendor dependencies, so no per-package symlinks are needed beyond the canonical vendor/ checkout.

You can populate vendor/ by hand, or let cplus-pm, the standalone package manager, resolve and fetch dependencies for you (cplus-pm install).

The standard library

  • stdlib — I/O, collections, ownership wrappers, concurrency, files, and networking. The package you reach for first.

GPU & numerics

C+ talks to GPUs and BLAS as a consumer of the vendor SDKs, through plain C FFI with Drop-managed handles. See GPU & numerics for the backend matrix and how to pick one.

  • metal — typed Metal and MPS bindings for Apple GPU compute.
  • cuda — CUDA Runtime + cuBLAS bindings for NVIDIA GPUs.
  • accelerate — Apple CPU numerics (BLAS, vDSP).
  • cblas — cross-platform CPU BLAS (OpenBLAS / Netlib / MKL).
  • simd — portable f32x4 math plus integer lane helpers.

Platform

  • appkit — typed Cocoa / AppKit bindings for native macOS apps.
  • jni — minimal Java Native Interface bindings.

Utilities

  • clap — command-line argument parsing with a fluent builder.
  • json — a typed-enum JSON parser and serializer.
  • log — a leveled, zero-allocation structured logger.
  • uuid — RFC 4122 v4 UUIDs.
  • arena — a growable bump-pointer arena.
  • static-arena — a fixed-size, stack-resident arena.

Real-time

  • rt — lock-free primitives for the real-time contracts (rt and the platform rt_darwin).

Filter all 15 packages

stdlib Cross-platform

The C+ standard library: I/O, vectors, hash maps, files, networking, ownership wrappers (Box, Arc, Rc), concurrency, and result/option types. A vendored package, imported per module.

accelerate Apple

Bindings to Apple's Accelerate.framework: pre-tuned CPU numerics (BLAS via cblas, element-wise and reductions via vdsp) that ship in every macOS binary.

appkit Apple

Typed Cocoa / AppKit bindings for native macOS desktop apps: application lifecycle, windows, views, controls, and closure-free callbacks.

arena Cross-platform

A growable, multi-chunk bump-pointer arena for allocate-many, free-all workloads like parsers, compilers, and request-scoped allocations.

cblas GPU & AI

Reference CBLAS bindings (OpenBLAS / Netlib / MKL): the cross-platform CPU BLAS path. Level 1/2/3 routines — sdot, saxpy, sscal, snrm2, sasum, sgemv, sgemm, and d-variants — with typed Order and Transpose enums.

clap Cross-platform

Command-line argument parsing with a fluent builder: flags, long and short options, positional arguments, and typed match accessors.

cuda GPU & AI

Typed CUDA Runtime + cuBLAS bindings for NVIDIA GPUs: device management, Drop-managed DeviceBuffer (cudaFree) and cuBLAS Handle (cublasDestroy), and column-major sgemm / sgemv. Plain C FFI, no kernel language.

jni Android

Minimal Java Native Interface bindings: #[repr(C)] mirrors of the JVM dispatch tables, called through a function-pointer table exactly as C's JNI does.

json Cross-platform

A typed-enum JSON parser and serializer: a recursive Value enum, parse and to_string entry points, and is_* / as_* accessors. Drops payloads recursively.

log Cross-platform

A leveled, zero-allocation structured logger to stderr: configure level and colors once, then log at trace / debug / info / warn / error with no malloc per call.

metal GPU & AI

Typed Metal and MPS bindings for Apple GPU compute: devices, command queues, buffers, compute pipelines, and pre-tuned MPS matmul / FFT / softmax.

simd GPU & AI

3D math on f32x4 plus integer-widening lane helpers: Vec3, Vec4, Mat4x4, and composable integer lane ops like a 16-lane signed-byte dot product.

static-arena Cross-platform

A fixed-size bump-pointer arena whose buffer lives on the stack or in static storage: zero malloc, zero free, composes with the #[no_alloc] real-time contract.

uuid Cross-platform

RFC 4122 v4 UUIDs sourced from /dev/urandom, portable across macOS, Linux, and BSD. Generate, parse, and format with an infallible to_string.

rt Cross-platform

Lock-free, allocation-free real-time building blocks: the SpscRingU64 ring and FixedPoolU64 object pool, plus the rt_darwin platform controls (clock, thread QoS, page locking).