From: maranget@yquem.inria.fr (Luc Maranget)
To: Francois Colonna <colonna@ccr.jussieu.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] compilation with modules
Date: Fri, 17 Nov 2006 19:30:09 +0100 [thread overview]
Message-ID: <20061117183009.GA19149@yquem.inria.fr> (raw)
In-Reply-To: <455DF939.50802@ccr.jussieu.fr>
> 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
prev parent reply other threads:[~2006-11-17 18:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-17 18:02 Francois Colonna
2006-11-17 18:30 ` Luc Maranget [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061117183009.GA19149@yquem.inria.fr \
--to=maranget@yquem.inria.fr \
--cc=caml-list@yquem.inria.fr \
--cc=colonna@ccr.jussieu.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox