From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=NO_RELAYS autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: by yquem.inria.fr (Postfix, from userid 18041) id 0E77ABC0A; Fri, 17 Nov 2006 19:30:09 +0100 (CET) Date: Fri, 17 Nov 2006 19:30:09 +0100 To: Francois Colonna Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] compilation with modules Message-ID: <20061117183009.GA19149@yquem.inria.fr> References: <455DF939.50802@ccr.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <455DF939.50802@ccr.jussieu.fr> User-Agent: Mutt/1.5.9i From: maranget@yquem.inria.fr (Luc Maranget) X-Spam: no; 0.00; compilation:01 maranget:01 maranget:01 struct:01 ocamlc:01 compiler:01 struct:01 luc:01 luc:01 compile:01 compile:01 caml-list:01 modules:02 caml:02 francois:02 > 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 (At the end) Hope it helps, -- Luc Maranget