Library for binding to C libraries using pure OCaml
Browse cluster: OCaml Systems and Utilities →ocaml-ctypes is a library for binding to C libraries using pure OCaml, eliminating the need to write C stub functions. It provides a set of combinators in OCaml to describe the structure of C types—including numeric types, arrays, pointers, structs, unions, and functions—allowing developers to declare C function interfaces directly in OCaml without code generation. The library includes Cstubs_structs, a tool that uses C itself to generate correct ML definitions of structs and access compile-time constructs like macros, making data type binding safer and more reliable than manual definition. The project is written in OCaml and was created by Jeremy Yallop.