[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David MENTRE <dmentre@l...> |
| Subject: | Re: [Caml-list] Dynamic loading of bytecode |
Hello,
Tom <tom.primozic@gmail.com> writes:
> Say I have files a.ml:
>
> let f x = x - 1
>
> and b.ml:
>
> let g x y = x + f y - f x
let g x y = x + A.f y - A.f x
>
> and I compile them into bytecode
>
> ocamlc -c a.ml
> ocamlc -c b.ml
>
> and then I want to be able to load them into the toploop so that I could
> access both modules A and B:
>
> # let simplify x = B.g x - A.f x
>
>
> How do I do that?
* In command line given to ocaml toplevel:
$ ocaml a.cmo b.cmo
Objective Caml version 3.08.3
# B.g 1 2;;
* Inside the toplevel, you need to #load each bytecode file:
$ ocaml
Objective Caml version 3.08.3
# #load "a.cmo";;
# #load "b.cmo";;
# let simplify x = B.g x x - A.f x;;
val simplify : int -> int = <fun>
TFM: http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html
Best wishes,
d.
PS: This kind of question might better go to caml-beginners@ mailing
list.
--
GPG/PGP key: A3AD7A2A David MENTRE <dmentre@linux-france.org>
5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A