* [Caml-list] Problem using modules like "Str", "Graphics" under Windows
@ 2004-05-08 14:53 Henning Sudbrock
2004-05-08 15:07 ` Richard Jones
2004-05-08 15:16 ` Sylvain LE GALL
0 siblings, 2 replies; 3+ messages in thread
From: Henning Sudbrock @ 2004-05-08 14:53 UTC (permalink / raw)
To: caml-list
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.
I would be thankful for any help with this problem.
With kind regards, Henning Sudbrock
--
Henning Sudbrock <hsudbrock@web.de>
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Problem using modules like "Str", "Graphics" under Windows
2004-05-08 14:53 [Caml-list] Problem using modules like "Str", "Graphics" under Windows Henning Sudbrock
@ 2004-05-08 15:07 ` Richard Jones
2004-05-08 15:16 ` Sylvain LE GALL
1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2004-05-08 15:07 UTC (permalink / raw)
To: Henning Sudbrock; +Cc: caml-list
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 = <fun>
(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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Problem using modules like "Str", "Graphics" under Windows
2004-05-08 14:53 [Caml-list] Problem using modules like "Str", "Graphics" under Windows Henning Sudbrock
2004-05-08 15:07 ` Richard Jones
@ 2004-05-08 15:16 ` Sylvain LE GALL
1 sibling, 0 replies; 3+ messages in thread
From: Sylvain LE GALL @ 2004-05-08 15:16 UTC (permalink / raw)
To: caml-list
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.
>
> I would be thankful for any help with this problem.
>
> With kind regards, Henning Sudbrock
>
Hello,
What about :
For interactive use of the str library, do:
ocamlmktop -o mytop str.cma
./mytop
or (if dynamic linking of C libraries is supported on
your platform), start ocaml and type #load "str.cma";;.
Kind regard
Sylvain Le Gall
-------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-08 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-08 14:53 [Caml-list] Problem using modules like "Str", "Graphics" under Windows Henning Sudbrock
2004-05-08 15:07 ` Richard Jones
2004-05-08 15:16 ` Sylvain LE GALL
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox