I’m trying to load my modules in .cmo into the toplevel, I had tried:
$ ocaml mymodule.cmo
I got the toplevel prompt, but I couldn’t refer to Mymodule
I also tried the
#load "mymodule.cmo"
It did not complain but still can’t refer to Mymodule
I also tried
#use "mymodule.ml"
This seems to work, but it does not load the code into the Mymodule namespace, which is a problem because I actually want to load a few modules into top-level, and they refer to each other by their module namespace.
After you do
you can refer to your module, but you still need to use the module name:
If you want to use a simple name (
x), you also need toopenthe module:This could be the source of your problem.
Here’s a session that shows what I’m talking about: