|
|
ocamlrun caml.out arg1 arg2 ... argnexecutes the compiled code contained in caml.out, passing it as arguments the character strings arg1 to argn. (See chapter 10 for more details.)
./caml.out arg1 arg2 ... argnThe produced file has the executable bit set, and it manages to launch the bytecode interpreter by itself.
|
Never use the strip command on executables produced by ocamlc -custom. This would remove the bytecode part of the executable.
|
|
type foo = A | B let f = function A -> 0 | B -> 1 type foo = C | D f CThis result in the error message ``expression C of type foo cannot be used with type foo''.
let sort_int_list = Sort.list (<) (* inferred type 'a list -> 'a list, with 'a not generalized *)write
let sort_int_list = (Sort.list (<) : int list -> int list);;
let map_length = List.map Array.length (* inferred type 'a array list -> int list, with 'a not generalized *)write
let map_length lv = List.map Array.length lv
mod1.ml: let f x = ... Mod2.g ... mod2.ml: let g y = ... Mod1.f ...define
mod1.ml: let f g x = ... g ... mod2.ml: let rec g y = ... Mod1.f g ...and link mod1.cmo before mod2.cmo.
mod1.ml: let forward_g = ref((fun x -> failwith "forward_g") : <type>) let f x = ... !forward_g ... mod2.ml: let g y = ... Mod1.f ... let _ = Mod1.forward_g := gThis will not work if g is a polymorphic function, however.