From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA16980; Sat, 8 May 2004 17:07:21 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA17114 for ; Sat, 8 May 2004 17:07:20 +0200 (MET DST) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i48F7GSH001990 for ; Sat, 8 May 2004 17:07:19 +0200 Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1BMTQ3-0002kj-00; Sat, 08 May 2004 16:07:15 +0100 Date: Sat, 8 May 2004 16:07:15 +0100 To: Henning Sudbrock Cc: caml-list@inria.fr Subject: Re: [Caml-list] Problem using modules like "Str", "Graphics" under Windows Message-ID: <20040508150715.GA10529@redhat.com> References: <20040508164752.C306.HSUDBROCK@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040508164752.C306.HSUDBROCK@web.de> User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at concorde with ID 409CF7A5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 3.07:01 stdlib:01 dynlink:01 3.07:01 'open:01 'open:01 cmi':01 autoconf:01 automake:01 compiles:01 rpms:01 ltd:98 regexp:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, May 08, 2004 at 04:53:12PM +0200, Henning Sudbrock wrote: > Hello, > > I am trying to use the module "Str" with ocaml 3.07+2. > > My problem is that when I enter a command like "Str.split;;" in the > ocaml-toplevel, I get the answer "Reference to undefined global 'Str' ". > Also when I try to open the module via "open Str;;" first, I get the > same answer when typing "split;;" afterwards. Parts of the "standard library" aren't actually included in stdlib.cma, which is the standard library file which every OCaml program opens by default. These include: * unix * str * dynlink * graphics For these specific modules, you have to actually load the library by hand (or link to it explicitly, if you're compiling an executable). In your case you should do: Objective Caml version 3.07+2 # #load "str.cma";; # Str.split;; - : Str.regexp -> string -> string list = (NB. the #load command). OK, so second question is why does 'open Str' succeed, even though OCaml won't be able to find that module if it wasn't loaded? This is trickier to answer, but basically what happens is that 'open Str' looks at and loads the interface definition file ('str.cmi' in this case). But it doesn't check that the module has actually been loaded. BTW, there is an ocaml-beginners list on Yahoo Groups for these sorts of questions. Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles, RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners