Libraries with Ocaml
I’ve been trying to learn a little more about Ocaml, since functional programming is so frequently marketed as solving a lot of today’s bad programming practices that lead to vulnerabilities and security problems.
I’ve been going through the Ocaml Tutorial but the instructions for building grtest1.ml were insufficient:
$ ocamlc grtest1.ml -o grtest1
Error while linking grtest1.cmo: Reference to undefined global `Graphics’
I needed to specify the name of the library I’m using:
$ ocamlc graphics.cma grtest1.ml -o grtest1
which on my Mac OS X system comes from /usr/local/lib/ocaml/.
April 18, 2008 at 11:08 am
You could also write a one-line configuration file called
_tagscontaining<*>: use_graphics
and then write
$ ocamlbuild grtest1.byte
OCamlBuild rocks seriously.