← All repos

ocaml-ctypes

Library for binding to C libraries using pure OCaml

Browse cluster: OCaml Systems and Utilities
1,670commits
65contributors
5languages

Tech stack & purpose

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.

Community & reference links

Languages

OCaml
81.9%
C
17.5%
Dune
0.3%
Makefile
0.2%
Gnuplot
0.1%

Contributors (top 30 of 65)