Version française
Home     About     Download     Resources     Contact us    
Browse thread
Toplevel - load cmo from given location
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Zheng Li <zheng_li@u...>
Subject: Re: Toplevel - load cmo from given location
Hi,

On 1/9/2009 3:06 PM, Dawid Toton wrote:
> But this version not (using the full path directly):
>
> #!/usr/bin/ocamlrun ocaml
> #load "/home/dt2/Calc1/CalcEngine/src/_build/extlib/enum.cmo"
> open Enum
>
> The problem is that it gives "Unbound module Enum" while no error about
> loading the cmo&cmi is shown.

It's because the toplevel doesn't have the "/home/dt2/..." in its paths, 
so it doesn't know where the enum.cmi is.

> So:
> * if it finds correctly the enum.cmi: why "open Enum" doesn't work?

No, it doesn't find the enum.cmi

> * if the cmi is not found, why I see no message like "*Cannot find file
> */home/dt2/Calc1/CalcEngine/src/_build/extlib/enum.cmi*" - as chapter

The enum.cmi was there, it was because the toplevel didn't know about 
this path. So it had the same effect as accessing a non-existed module 
or a module existed but not in the known paths (e.g. open NoSuchModule).

> 9.4 of docs suggests? Does the toplevel check for the cmi in the same
> location as cmo? *

No. Basically, cmi and cmo are two different things. You using one 
doesn't mean you'll use the other.

Using the "directory" directive or launching toplevel with "-I" 
parameters can add extra paths to toplevel (for accessing both cmi and cmo).

HTH.
--
Zheng