[ANN] ocaml-posix release 4.0.0

Hi there!

I’m happy to report the release of ocaml-posix version 4.0.0: GitHub - savonet/ocaml-posix: Bindings to the various POSIX APIs

This collection of modules was started some time ago with the goal of centralizing and normalizing the patterns for binding constants, types (including C stuct ) and functions from the POSIX standard using ctypes.

The goal is to offer:

  • A common set of tools and practices for structuring and binding using ctypes.
  • APIs and modules suitable for low-level ctypes use.
  • High level APIs and modules suitable for direct OCaml use.
  • Multi platform compatibility: *BSD, linux, macos and windowswhen available.
  • Cross-platform compilation using dune’s awesome cross-compilation support when applicable (currently only posix-errnoand posix-socket)

With this release, 4 new modules have been added:

  • posix-errno to deal with unix error numbers. Although there are some alternatives already existing, this one is a more straight-forward and modern implementation using dune for building with cross-compilation and multi-platform support.
  • posix-stat, posix-resource and the extensive posix-unistd.

Hopefully these modules can be useful to more developers and provide a common platform for interfacing OCaml programs with system calls in a portable and extensible way!

FAQ:

  • Why is this not using dune’s direct support for ctypes?

Cross-compilation support requires running binary compiled for the target (e.g. windows) on the host (e.g. linux) in order to extract specific data points such as C constants values and C struct entries offset. Currently, this is not supported using dune’ builtin ctypes support. However, support for this is being worked on.

9 Likes