caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problem with ocamlmktop
@ 2004-09-10 22:28 Malte Obbel Forsberg
  2004-09-11 16:13 ` David MENTRE
  0 siblings, 1 reply; 2+ messages in thread
From: Malte Obbel Forsberg @ 2004-09-10 22:28 UTC (permalink / raw)
  To: caml-list

Hello fellow O'Caml-users,

I'm pretty new to O'Caml, and there's something with ocamlmktop that 
puzzles me (albeit it probably being rational behaviour that I merely 
need to comprehend before I can move on and solve the problem :-)):

When I make a new toplevel, by first running ocaml -c for site.mli and 
then for site.ml, with ocamlmktop site.cmo, I can't seem to use it if it 
doesnt stay in the same directory as the *.cm* files reside. Furtermore 
it seems I have to be in that directory when executing my toplevel as 
well. The following text describes the phenomena:

/var/www/site# ocamlmktop site.cmo -o site-toplevel
/var/www/site# ls
site-toplevel  site.cmi  site.cmo  site.ml  site.mli
/var/www/site# ./site-toplevel
         Objective Caml version 3.08.1

# Site.read ;;
- : string -> string = <fun>
#
/var/www/site# cd ..
/var/www# ./site/site-toplevel
         Objective Caml version 3.08.1

# Site.read ;;
Unbound value Site.read
#

Now, what I want to do is to use a modified toplevel for mod_ocaml, so I 
won't have to redefine my functions in every ocml (html with ocaml-code 
in it, handled by mod_ocaml) file! I suppose, being quite new to O'Caml, 
I might have missed some other way to achieve this; please enlighten me 
if that is so. :-)

What I want to know, then, is if there is some way to define functions 
in an external file and then use the functions in an other interpreted 
file, with "open Site;;" or similar.

Best regards,
Malte Obbel Forsberg

-------------------
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] 2+ messages in thread

* Re: [Caml-list] Problem with ocamlmktop
  2004-09-10 22:28 [Caml-list] Problem with ocamlmktop Malte Obbel Forsberg
@ 2004-09-11 16:13 ` David MENTRE
  0 siblings, 0 replies; 2+ messages in thread
From: David MENTRE @ 2004-09-11 16:13 UTC (permalink / raw)
  To: Malte Obbel Forsberg; +Cc: caml-list

Hello,

Malte Obbel Forsberg <malte@unix.se> writes:

> Now, what I want to do is to use a modified toplevel for mod_ocaml, so I
> won't have to redefine my functions in every ocml (html with ocaml-code
> in it, handled by mod_ocaml) file! I suppose, being quite new to O'Caml,
> I might have missed some other way to achieve this; please enlighten me
> if that is so. :-)

You could use -I option with an absolute path when calling your home
made ocaml.

> What I want to know, then, is if there is some way to define functions
> in an external file and then use the functions in an other interpreted
> file, with "open Site;;" or similar.

Yep. #load "file-name";; or #use "file-name";; depending on your
needs. Then do a open Module or Module.function. See ocaml doc for
details.

Yours,
david
-- 
 David Mentré <dmentre@linux-france.org>

-------------------
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] 2+ messages in thread

end of thread, other threads:[~2004-09-11 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10 22:28 [Caml-list] Problem with ocamlmktop Malte Obbel Forsberg
2004-09-11 16:13 ` David MENTRE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).