Compile multiple ocaml files

Ok, so the toplevel works more like an interpreter, it is not used to compile files.
So going back to your example, you might define some functions in file.ml,
which you then want to use in some other code that depends on it.
You would start a toplevel session (by calling ocaml or utop on the command line),
and then in the interactive session, you can type #use "file.ml" to use these definitions.
However you cannot use that to compile the code that you passed through the toplevel.
I’m not sure if that clarifies anything or not…
There’s just been a nice reply to another topic that might help you:

2 Likes