"roparzhhemon" < roparzhhemon%40yahoo.com.br">roparzhhemon
yahoo.com.br> writes:
> I'm not quite sure I understand what you mean : in my example
> the "Special_dir" subdirectory contains not only MyMod.cmo, but
> also MyMod.cmi and MyMod.ml (of course, they were all generated
> from MyMod.ml with ocamlc -c, which had no trouble with
> different directories). Do you mean that MyMod.cmi should be moved
> from Special_dir/ to / for the toplevel to work properly ?
I assume that you compiled your toplevel with command like:
ocamlmktop -I Special_dir -o mytoplevel MyMod.cmo
As indicated in the ocamlmktop section of the OCaml manual
(http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html#htoc114),
the only functionality of option "-I directory" is to add searching directory
"for compiled object code files" to be linked with the new toplevel. In your
case, "-I Special_dir" did help ocamlmktop to find the place where MyMod.cmo
located, and MyMod.cmo was actually linked into the produced
mytoplevel. However, the "-I" option doesn't says that the produced new
toplevel will remember the Special_dir, since it's of use to remember that --
you may move them all around in any time later (e.g. installation). So your
brand new toplevel doesn't know where the *interface* file MyMod.cmi is located
and can't help you to access this unknown module, even if you've already
embedded the implementation of .cmo file.
As Jonathan mentioned above, there is no straightforward way to ask the
produced new toplevel to remember this path, even if you may not intend to
move the MyMod.cmi to other directories. Give either of the following
conditions
- the absolute path of the MyMod.cmi's installation directory is know
- the relative path of MyMod.cmi's installation directory (to the new
toplevel's installation directory)
You can still play some tricks (e.g. a shell script with -I option or a
initialization caml program secretly adding the correct path) to get a
toplevel without having to put into "#directory XXX" manually each
time. However, I'm really doubting it's necessary in your case.
HTH
-code17
.