Ctypes

Ctypes is a library for binding to C libraries using pure OCaml. The primary aim is to make writing C extension as straightforward as possible. The current foreign function interface (FFI) in OCaml is low-level and difficult to use correctly, so we’re keen to improve the ease-of-interoperability via the OCaml Platform.

The core of ctypes is a set of combinators for describing the structure of C types: numeric types, arrays, pointers, structs, unions and functions. You can use these combinators to describe the types of the functions that you want to call, then bind directly to those functions - all without writing or generating any C!

Further Reading


Recent Activity

News
: A Busy Week - Multicore, Releases, Interns and Visitors
: Ctypes 0.6 Released - async FFI support and Improved Cross Compilation
: A new Reason for OCaml
: Docker for Mac and Windows Beta
Papers
: OCaml Inside: a drop-in replacement for libtls
: A modular foreign function interface - PREPRINT
: Declarative foreign function binding through generic programming
: Ctypes: Foreign Calls in your Native Language