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: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Toplevel - load cmo from given location
On Fri, Jan 09, 2009 at 03:08:18PM +0000, Dawid Toton wrote:
> 
> >>The problem is that it gives "Unbound module Enum" while no error about 
> >>loading the cmo&cmi is shown.
> >
> >The #directory instruction is needed to find the .cmi.
> 
> I see, so there are 2 problems:
> * why the failure to load cmi is silent in this case?
> * why the toplevel fails to check for cmi where the cmo is located? This 
> looks as incorrect behaviour (the reference manual doesn't mention any 
> exceptional rules for the #load directive).

As you say this is kind of a bug.  You cannot solve it by assuming
some sort of one-to-one relationship between .cmi files and .cmo files
though.  You can have .cmi without .cmo, or .cmo without .cmi, or lots
of .cmi and a .cma, and probably other combinations.

Couple of practical points though: (1) Use ocamlfind in the toplevel
to solve all these problems:

  # #use "topfind";;
  - : unit = ()
  Findlib has been successfully loaded. Additional directives:
    #require "package";;      to load a package
    #list;;                   to list the available packages
    #camlp4o;;                to load camlp4 (standard syntax)
    #camlp4r;;                to load camlp4 (revised syntax)
    #predicates "p,q,...";;   to set these predicates
    Topfind.reset();;         to force that packages will be reloaded
    #thread;;                 to enable threads
  
  - : unit = ()
  # #require "netstring";;
  /usr/lib64/ocaml/pcre: added to search path
  /usr/lib64/ocaml/pcre/pcre.cma: loaded
  /usr/lib64/ocaml/unix.cma: loaded
  /usr/lib64/ocaml/netsys: added to search path
  /usr/lib64/ocaml/netsys/netsys.cma: loaded
  /usr/lib64/ocaml/netstring: added to search path
  /usr/lib64/ocaml/netstring/netstring.cma: loaded
  /usr/lib64/ocaml/netstring/netstring_top.cmo: loaded
  /usr/lib64/ocaml/netstring/netaccel.cma: loaded
  /usr/lib64/ocaml/netstring/netaccel_link.cmo: loaded

(2) Bugs should go in the bug tracker here:
http://caml.inria.fr/mantis/

Rich.

-- 
Richard Jones
Red Hat