OpenBSD Handbook

Current snapshot · amd64 · Generated 2026-09-09

c2ffi-21.1.0.20260104

extract FFI definitions from C, C++, and Objective C

Back to search · Project homepage

Description

This is a tool for extracting definitions from C, C++, and Objective C headers for use with foreign function call interfaces. There are generally two steps to using `c2ffi`: - Generate output for a particular header or file, gathering macro definitions (with the `-M <file>.c` parameter) - Generate output for macro definitions by running `c2ffi` again on the *generated* file (without `-M`) Currently JSON is the default output. This is in a rather wordy hierarchical format, with each object having a "tag" field which describes it. All objects are contained in an array. This should make it fairly easy (or at least far easier than parsing C yourself) to transform into language-specific bindings. The following language bindings exist for `c2ffi`: - [cl-autowrap](https://github.com/rpav/cl-autowrap/): Create bindings in Common Lisp from a `.h` with `c2ffi` using a simple `(c-include "file.h")` - [c2ffi-ruby](https://github.com/rpav/c2ffi-ruby): Uses the JSON from c2ffi to produce a nicely-formatted Ruby file for ruby-ffi.

Package information

Ports path
devel/c2ffi
Package architecture
amd64
Maintainer
Sebastien Marie <semarie@kapouay.eu.org>
Categories
devel
Available flavors
None listed
Only for architectures
aarch64, amd64, arm, i386, mips64, mips64el, powerpc, powerpc64, riscv64, sparc64, alpha, hppa, m88k, sh

These are ports metadata. Binary availability depends on the release, architecture and mirror. Build and test dependencies are not an installation checklist.

Direct dependencies

Library

Build

Installing and updating packages · Package details as JSON