Previous Up Next

Going further

We have shown how OCaml’s Sys, Unix, and Threads modules can be used to program applications that interact with the operating system.

These modules allow the invocation of the most important Unix system calls directly from OCaml. Some of these calls were replaced by higher-level functions, either to facilitate programming or to maintain invariants needed by OCaml’s runtime system. In any case, this higher-level access to the Unix system streamlines the development of applications.

Not every feature of the Unix system is available through these modules, however it is still possible to access the missing ones by writing C bindings.

Another useful library is Cash [3] which focuses on writing scripts directly in OCaml. This library completes the Unix module in two different ways. First, in addition to a few helper functions to write scripts, it provides, on top of the Unix module, a few system call variations to assist the programmer in process and pipe management. Second, it offers additional entry points to the Unix system.

Previous Up Next