Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] An elementary question about ocamlmktop
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ching-Tsun Chou <ctchou@m...>
Subject: [Caml-list] An elementary question about ocamlmktop

I'm sure this question of mine has a simple answer, but, alas, I
couldn't figure it out myself after many trials!

Suppose I have a subdirectory "zzz" under my home directory which
contains a file "foo.ml" whose content is:

$ cat zzz/foo.ml

let hello () = Printf.printf "Hello, world!\n"

where "$ " is the shell prompt.  Now I do the following:

$ cd zzz
$ ocamlmktop foo.ml -o foo
$ ./foo 
        Objective Caml version 3.06

# Foo.hello () ;;
Hello, world!
- : unit = ()

So far, so good.  But now I do the following:

$ cd
$ zzz/foo
        Objective Caml version 3.06

# Foo.hello () ;;
Characters 0-9:
  Foo.hello () ;;
  ^^^^^^^^^
Unbound value Foo.hello

I think the problem is that ocamlrun can't find "foo.cmi", since the
same problem occurs even in "zzz" if "foo.cmi" is removed (removing
"foo.cmo" apparently has no effect).  However, if I do:

$ zzz/foo -I ~/zzz
        Objective Caml version 3.06

# Foo.hello () ;;
Hello, world!
- : unit = ()

then everything works again (assuming "zzz/foo.cmi" is still there).

My question is: Is there any way to generate a toplevel "foo" that
contains the information in "foo.cmi", so that it can (so to speak)
exists by itself?

Many thanks in advance!

- Ching Tsun
-------------------
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