Ctypes 0.6 Released - async FFI support and Improved Cross Compilation

Jeremy Yallop announced the 0.6.0 release of ocaml-ctypes, which is now available on OPAM.

Besides several new features such as support for asynchronous foreign function calls and improved cross compilation support, this release introduces a number of backwards-incompatible changes, which are described below. If your code is available on OPAM and is affected by these changes then you should have received a pull request with a fix. If you have questions about how to update your code, please feel free to post to the mailing list.

Selected new features:

  • The Cstubs.FOREIGN interface has been extended with returning and @->, and with some new types. See PR#389 for details.
    NB: code that generates bindings using Cstubs may need to be updated to select return and @-> from the bindings functor argument rather than from the Ctypes module. Code that needs to be updated will fail to compile with the new interface. The pull request shows how to update your code, if necessary.
  • The Cstubs module can now generate asynchronous bindings to C functions using the Lwt jobs framework. See the PR#391 for details.
  • The Cstubs module now supports optionally returning errno alongside the return value of bound C functions. See PR#392 for details.
  • Cross-compilation support is improved: the configuration step no longer runs binaries on the host. See PR#383 for details.
  • The Unsigned.S interface has new of_int64 and to_int64 functions.


Besides the changes to Cstubs.FOREIGN, ocaml-ctypes 0.6.0 introduces the following backwards-incompatible changes:

  • The deprecated *:* and +:+ functions have been removed. Use Ctypes.field instead.
  • OCaml 4.00.* is no longer supported. The earliest supported OCaml release is 4.01.0.

You can find the full ChangeLog on the main repository.

Related Posts

Author | Gemma Gordon

Gemma is the Operations Director for the OCaml Labs group in the Cambridge Computer Laboratory, and covers day-to-day management, investigates funding opportunities and organises events.