List Info

Thread: "ocaml_beginners"::[] .cmo file found, but module still unbound




"ocaml_beginners"::[] .cmo file found, but module still unbound
user name
2007-01-27 11:29:43

Hello all,

in principle a module whose .cmo file is in a faraway directory
should be treated no different from the other modules, as long
as you provide the the OCaml compiler with the
correct path. I have
this problem, however :

Say that the files MyMod.ml, MyMod.cmi and MyMod.cmo
are in the subdirectory Special_dir/. Now, if I launch my
customized toplevel defined with ocmalmktop (which
includes Special_dir/MyMod.cmo in its definition),

(1) It does not know about the MyMod module. (The
module "MyMod" is unbound).

(2) However, if I type

#load "Special_dir/MyMod.cmo",

the compiler does not complain. (but
MyMod is still unbound after that!) This means that
it found the .cmo file and read it correctly, right ?

Ewan

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] .cmo file found, but module still unbound
user name
2007-01-27 12:05:20

For a toplevel, it can't manipulate functions in a .cmo without the
corresponding .cmi file being accessible in the path.

This is a design decision, since both ocaml, ocamlc, and ocamlopt
require the information present in the .cmi files -- which is all the
typing information, etc.

Since the toplevel needs type information, it needs the cmi. I'm not
currently aware of any way around that limitation.

Jonathan

On 1/28/07, roparzhhemon < roparzhhemon%40yahoo.com.br">roparzhhemonyahoo.com.br> wrote:
&gt; Hello all,
>;
> in principle a module whose .cmo file is in a faraway directory
> should be treated no different from the other modules, as long
>; as you provide the the OCaml compiler with the
> correct path. I have
>; this problem, however :
>
> Say that the files MyMod.ml, MyMod.cmi and MyMod.cmo
> are in the subdirectory Special_dir/. Now, if I launch my
> customized toplevel defined with ocmalmktop (which
&gt; includes Special_dir/MyMod.cmo in its definition),
>
> (1) It does not know about the MyMod module. (The
>; module "MyMod" is unbound).
>
&gt; (2) However, if I type
>;
> #load "Special_dir/MyMod.cmo&quot;,
>
> the compiler does not complain. (but
>; MyMod is still unbound after that!) This means that
>; it found the .cmo file and read it correctly, right ?
>
> Ewan
>;
>
>
>
>
&gt; Archives up to November 11, 2006 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
> The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames etc.
>; Yahoo! Groups Links
&gt;
>
>
>;

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )