Previous Contents Next

Using the Graphics Module

Utilization of the library Graphics differs depending on the system and the compilation mode used. We will not cover applications other than usable under the interactive toplevel of Objective CAML. Under the Windows and MacOS systems the interactive working environment already preloads this library. To make it available under Unix, it is necessary to create a new toplevel. This depends on the location of the X11 library. If this library is placed in one of the usual search paths for C language libraries, the command line is the following:
ocamlmktop -custom -o mytoplevel graphics.cma -cclib -lX11
It generates a new executablemytoplevel into which the library Graphics is integrated. Starting the executable works as follows:
./mytoplevel
If, however, as under Linux, the library X11 is placed in another directory, this has to be indicated to the command ocamlmktop:
ocamlmktop -custom -o mytoplevel graphics.cma -cclib \ 
           -L/usr/X11/lib -cclib -lX11
In this example, the file libX11.a is searched in the directory /usr/X11/lib.

A complete description of the command ocamlmktop can be found in chapter 7.


Previous Contents Next