staff web u of c library
  Departments > DLDC > Programming > Programming Languages

The OCaml Programming Language at DLDC The Caml Language

The OCaml programming language is used extensively at the DLDC to write many back-end data processing tools, utilities and one-shot programs.

Home Page

http://caml.inria.fr/

How Installed

OCaml is in the FreeBSD ports and the pkgsrc; it comes pre-installed on some Linux distributions, and RPMs are readily available; it's also available via Darwin Ports and Fink on Mac OS X. However, I prefer to install OCaml via GODI, a platform-independent OCaml-specific package manager, which provides an easy way to install OCaml from source. The GODI distribution includes dozens of essential third-party libraries and makes it easy to install them, upgrade them, and keep them all in sync. I install GODI under /usr/app/godi/; to use the compilers, add /usr/app/godi/bin/ to your PATH.

Where Installed

I like to statically-link OCaml native-code apps to get single-file executables that can be installed on a new box with a single cp command (with no prerequisites like an interpreter or run-time system). But, since OCaml doesn't have a cross-compiler, in order to build such executables, we need one compilation box for each OS / CPU "platform"1. Here's the official list of compilation boxes; some OS's (the BSD's) are very good at running binaries compiled on older versions of the OS, and some less so (Linux); problems usually have to do with missing old shared libraries, which is another reason static linking is nice.

NetBSD-3 i386
jfcl
FreeBSD-5 i386
grenache
FreeBSD-7 i386
mystique
FreeBSD-7 amd64
quarto
Local Library Code

Most of my OCaml apps rely heavily on my personal OCaml library, Kw. I install it on every OCaml build box. You can link with it (using ocamlfind) like so:

ocamlfind ocamlopt -linkpkg -package kw foo.ml -o foo

Documentation is available.

Further Information

For more information about OCaml, including history, rationale, and pointers to books, tutorials, and documentation, see OCaml for the Skeptical; the slides from my course on functional programming also contain a lot of OCaml.

Footnotes

  1. OCaml apps can also be compiled to a portable byte-code, which requires the OCaml run-time system to be installed. This might be considered an "easier" way to get an OCaml app running on an exotic platform, since you can install the run-time system any way you want (e.g. via a native package manager, rather than via GODI).

Page Author: Keith Waclena

This page was last generated on 29 May 2009 at 12:18:46 PM by dldc-info
The URL of this page is http://www.lib.uchicago.edu/staffweb/depts/dldc/programming/langs/ocaml.html