C+
Packages · View as Markdown

llama_cpp

C+ bindings for llama.cpp's C API, in two layers:

  • Raw FFI generated straight from the upstream headers with cpc-bindgen (build.sh), so the binding tracks the C API rather than reimplementing it.
  • A hand-written safe facadeSession, with load / generate / tokenize / decode / sample — over that raw layer, so day-to-day use is ownership-safe C+ rather than raw pointers.

It links libllama and libmtmd. Rather than baking an absolute path into the manifest, the [link] search-path reads an environment variable, so the same binding works on any machine that points LLAMA_CPP_LIB at its own build:

[link]
search-paths = ["${LLAMA_CPP_LIB}"]

See Modules & packages for the [link] table and ${VAR} expansion. The llama_cpp_smoke recipe is verified end to end: it links against a current llama.cpp and runs real text generation on the Metal GPU (gemma-4-E2B). This is the runnable counterpart to the field journal on porting ggml to C+.