Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: What am I missing?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: What am I missing?
> Why?
> 
> [root@ruby] ~/felix>ocamlc util.ml
> [root@ruby] ~/felix>ocamlc util.mli
> [root@ruby] ~/felix>ocaml
>         Objective Caml version 2.02
> 
> # open Util;;
> # string_of_list;;
> Reference to undefined global `Util'

When you open a module you just add the list of exported names from
that module to your current environment (the interface of the module is
loaded). The corresponding implementation must be loaded (the code has
to be linked), before using any of the names defined in the
implementation. Use the pragma #load in the interactive environment to
link the code:

        Objective Caml version 2.02

# open Util;;
# #load"util.cmo";;
# string_of_list;;
- : 'a list -> string = <fun>

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/