Re: Module still unbound even after cmo has benn #load-ed
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <CAPFanBHjNPjtQ1stkQxfPLSumsRAWaLiyUdZHe1bmi7yXzNR+w@mail.gmail.com> |
The toplevel will only type-check modules whose .cmi file it has access to (regardless of whether its actual implementation in a .cmo or .cma can be loaded). If the .cmi file is not at the root of the current directory or in an include path (standard library, -I options), you can add their directories to the toplevel by using the directive #directory: #directory "subdir";; (* now you can use Foo whose interface is given in subdir/foo.cmi *) On Fri, Sep 11, 2015 at 11:04 AM, [email protected] [ocaml_beginners] <[email protected]> wrote: > > > This morning I copied my "root" OCaml directory containing all > my OCaml projects, to a different location on the same computer. > But a lot of weird things happened when I started to work in > the new directory. > > In case someone should ask, yes I checked that my makefile does > not contain any mention of the path to the directory it's in, and > yes when in my new directory first thing I did was delete all the > cma/o/i's and > recompile everything from scratch (and I repeated this operation when > trying to figure out what was wrong). > > The weird things happen with my customized toplevel : > > Weird phenomenon 1: even though the production/compilation > of the toplevel goes fine with zero warnings, the created > toplevel only knows about the modules whose .ml file is > situated in the root dicrectory. All the modules whose .ml > file is situated in a subdirectory are declared unbound. > > Weird phenomenon 2 : When I see that my toplevel does not > know about the module implemented in subdir/my_module.ml, > I naturally try the directive #load"subdir/my_module.cmo". > The toplevel recognizes the file (I know that because it does > not issue a "Cannot find file" message), but the module > My_module is still unbound after the directive has been > executed. > > Any help appreciated. > > > > > > > >