OCAML offers multiple dependencies

When I have multiple dependencies, for example

module A = struct
open B< br /> ...
end

module B = struct
...
end

Is it possible to make OCaml top-level/utop load A.ml with all dependencies (ie #use”./A.ml” automatically loads B.ml)?

You should use ocamlc to compile all modules to generate files a.cmo and b.cmo, and then run ocaml b.cmo a.cmo (the order is important because B must be loaded before A).

When I have multiple dependencies, let’s say

module A = struct
open B
...
end

module B = struct
.. .
end

Is it possible to make OCaml top-level/utop load A.ml with all dependencies (ie #use”./A.ml” automatically loads B.ml)?

You should use ocamlc to compile all modules to generate files a.cmo and b.cmo, and then run ocaml b.cmo a.cmo (the order is important, Because B must be loaded before A).

Leave a Comment

Your email address will not be published.