Skip to main content
The C++ adapter is a header-only library that wraps the C ABI in RAII types and std::span. No separate build step is required.

Installation

Copy zinc.hpp into your project:
Link against libzinc_core at build time:

SharedRegion

create

Creates a new region. Throws std::system_error on failure. The error code maps to the negated Zinc error code.

open

Opens an existing region.

bytes

Returns a std::span<std::byte> backed by the shared memory mapping. No copying occurs.
A const overload is available for read-only access:

capacity

notify

wait

Returns true on notification, false on timeout.

RAII semantics

SharedRegion is move-only. It cannot be copied. The handle closes automatically when it goes out of scope.

Complete example

This uses two handles in one process. For separate processes, keep the creator running until the reader finishes. Spans must not outlive their region. try_wait() consumes a pending notification without blocking.

Requirements

  • C++20 or later (for std::span)
  • A C++ compiler that supports std::span on Linux or macOS
  • The zinc_core shared library on the library search path at runtime