Reputation: 3088
As I understand, graphics.cmax isn't exist. But how to compile ocaml program with using Graphics module by ocamlopt? Is it possible? Maybe some alternative graphics libraries?
Upvotes: 2
Views: 1061
Reputation: 35210
Well, graphics.cmax indeed doesn't exist, why it should? But graphics.cmxa does. So of course it is possible compile programs that use graphics library to a machine code. You can use ocamlfind
to find a proper library depending on your compilation mode. For example on mine machine:
$ ocamlfind query -predicates native -a-format graphics
/home/ivg/.opam/fresh/lib/ocaml/graphics.cmxa
In a simple case, like this, with the graphics library that is distributed with the OCaml system itself, you can just add graphics.cmxa
to the compilation string. On more complex cases, just use ocamlfind ocamlopt
instead of ocamlopt
, and specify -package
option to refer to a library name, in your case it would be:
$ ocamlfind ocamlopt -package graphics ...
Or you can use ocamlbuld
:
$ ocamlbuild -package graphics my_cool_application.native
where your cool application has an entry point in the my_cool_application.ml
file.
Upvotes: 2