[ocaml-ctypes] ANN: ocaml-ctypes 0.5.0, a library for calling C functions directly from OCaml

Jeremy Yallop yallop at gmail.com
Mon Mar 21 19:42:05 GMT 2016


I'm pleased to announce release 0.5.0 of ocaml-ctypes, which is now
available on OPAM.

== About ocaml-ctypes ==

The ocaml-ctypes library makes it possible to call C functions from
OCaml without writing any C code.  The core of the library is a set of
combinators for describing C types -- scalars, functions, structs,
unions, arrays, and pointers to values and functions.  Type
descriptions can then be used to bind native functions and values.
Here's a simple example:

    # let puts = foreign "puts" (string @-> returning int);;
    val puts : string -> int = <fun>
    # puts "Hello, world!";;
    Hello, world!

Ctypes includes many more features, including functions for retrieving
constants, values and details about object layout from C, a way of
building C libraries from OCaml modules, and a variety of binding
strategies such as dynamic linking and static stub generation. Further
information is available at the links below:

  Tutorial: https://github.com/ocamllabs/ocaml-ctypes/wiki/ctypes-tutorial
  Examples: https://github.com/ocamllabs/ocaml-ctypes/tree/master/examples
  Some packages using ctypes:
http://opam.ocaml.org/packages/ctypes/ctypes.0.5.0/
  API documentation: http://ocamllabs.github.io/ocaml-ctypes/
  Github repository: https://github.com/ocamllabs/ocaml-ctypes
  Direct download:
https://github.com/ocamllabs/ocaml-ctypes/archive/0.5.0.tar.gz

== Selected new features in 0.5.0 ==

* Improved support for various standard C and POSIX integer types
  (time_t, ssize_t, ptrdiff_t, intptr_t, uint8_t, and many more).

* Improved support for conversions between function pointers and other
pointer types

* Support for releasing the runtime lock in the Cstubs_inverted module.

* An experimental interface for managing OCaml roots.

See the release notes for the full list of changes:

    https://github.com/ocamllabs/ocaml-ctypes/blob/0.5.0/CHANGES.md

== Thanks ==

I'm grateful to Andreas Hauptmann, David Sheets, Etienne Millon,
Goswin von Brederlow, Leonid Rozenberg, @orbitz, Max Mouratov, and
Peter Zotov for contributions to this release.


More information about the Ctypes mailing list