[
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: | maranget@y... |
| Subject: | Re: [Caml-list] compilation with modules |
> Hello
>
> Could somebody tell me how to compile a piece of code ( "my_code.ml") using
> a module ("my_tools.ml")
>
> Here are the files :
> ___ my_tools.ml ____
>
> module My_tools =
> struct
> let print_a_string a_string =
> print_string (a_string)
> ;;
> end
>
> and
> ___ my_code.ml ____
>
> open My_tools
> let a_string = "a string" ;;
> print_a_string a_string ;;
>
>
> Thanks
> François Colonna
>
Just change my_code.ml
--- my_code.ml ---
open My_tools.My_tools
let a_string = "a string" ;;
print_a_string a_string ;;
---------------------
compile as follows
ocamlc my_tools.ml my_code.ml
Basically the file a.ml is interpreted by the compiler
as
module A = struct
contents of a.ml
end
There is a more complete description in the manual
<http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html>
(At the end)
Hope it helps,
--
Luc Maranget