From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 8DDD4BBAF for ; Fri, 21 Jul 2006 13:49:46 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6LBnkQa020003 for ; Fri, 21 Jul 2006 13:49:46 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA18418 for ; Fri, 21 Jul 2006 13:49:45 +0200 (MET DST) Received: from osiris.uid0.sk ([62.168.97.100]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6LBnjjr020000 for ; Fri, 21 Jul 2006 13:49:45 +0200 Received: from osiris.uid0.sk (localhost [127.0.0.1]) by nod32.uid0.sk (Postfix) with ESMTP id BC4ED87C3FF for ; Fri, 21 Jul 2006 13:53:25 +0200 (CEST) Received: from osiris.uid0.sk (localhost [127.0.0.1]) by osiris (nod32smtp); Fri, 21 Jul 2006 13:53:25 +0200 X-Virus-Scanner: This message was checked by NOD32 Antivirus system for Linux/BSD Server. For more information on NOD32 Antivirus System, please, visit our website: http://www.eset.com/. Received: by osiris.uid0.sk (Postfix, from userid 1002) id B52FA87C06B; Fri, 21 Jul 2006 13:53:25 +0200 (CEST) Date: Fri, 21 Jul 2006 13:53:25 +0200 From: Jozef Kosoru To: caml-list@inria.fr Subject: How to define submodules Message-ID: <20060721115325.GS3653@osiris.uid0.sk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-NOD32Result: clean X-Miltered: at nez-perce with ID 44C0BF5A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44C0BF59.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; submodules:01 parser:01 parser:01 ocamlc:01 ocamlc:01 cmo:01 ocaml:01 submodules:01 cmo:01 syntax:01 ocaml:01 syntax:01 unbound:01 compile:01 kernel:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hello, I'm trying to split my project files into several directories but I can't figure out how to do it right. Let's assume the following directory structure: Kernel/Parser/pdf.ml main.ml and let's define the content of above files as: ~~~ Kernel/Parser/pdf.ml ~~~ let init () = print_string "hello world\n";; ~~~ main.ml ~~~ Kernel.Parser.Pdf.init ();; ~~~ OK, and then I want to compile it (within a root directory): $ ocamlc -c Kernel/Parser/pdf.ml $ ocamlc -I . Kernel/Parser/pdf.cmo main.ml -o app File "main.ml", line 1, characters 0-22: Unbound value Kernel.Parser.Pdf.init Is this supposed to work somehow? I know that most ocaml programs use a bit cumbersome approach and they define long file names to emulate submodules. Eg. Kernel/Parser/kernel_Parser_Pdf.ml main.ml ~~~ main.ml ~~~ Kernel_Parser_Pdf.init ();; ~~~ And then: $ ocamlc -c Kernel/Parser/kernel_Parser_Pdf.ml $ ocamlc -I . -I Kernel/Parser/ \ Kernel/Parser/kernel_Parser_Pdf.cmo \ main.ml -o app but that is rather inelegant. But ANT project [1] uses this nice syntax. For instance, there are files: Engine/Evaluate.ml Main/Main.ml and Main.ml calls: let pages = Engine.Evaluate.evaluate ast ... is it some kind of language extension? I've noticed ANT uses a revised OCaml syntax but there is no such a thing mentioned in its documentation [2]. Thank you for any advice. Regards, Jozef [1] http://ant.berlios.de/ [2] http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html -- jozef kosoru http://zyzstar.kosoru.com