[
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: | 2006-07-21 (12:39) |
From: | Jozef Kosoru <zyzstar@u...> |
Subject: | Re: [Caml-list] How to define submodules |
On Fri, Jul 21, 2006 at 14:01:26 +0200, Jean-Christophe Filliatre wrote: > Jozef Kosoru writes: > > 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? > > No. > > First, to compile main.ml you need to pass "-I Kernel/Parser" to the > compiler, because it needs to find the file pdf.cmi. > > Second, in main.ml you have to write "Pdf.init" instead of > "Kernel.Parser.Pdf.init" because the directory structure is not turned > into a module structure in ocaml. Yes, that was my second example. That's not exactly what I want. > However, you can use the option -pack and -for-pack of the compiler to > pack several files as submodules of a new module; see the manual at > http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html Thank you! For the above example it's: $ ocamlc -for-pack Kernel.Parser -c Kernel/Parser/pdf.ml $ ocamlc -pack -o Parser.cmo -for-pack Kernel Kernel/Parser/pdf.cmo $ ocamlc -pack -o Kernel.cmo Parser.cmo $ ocamlc Kernel.cmo main.ml -o ap Now the last thing is how to convince my OMakefile to do it automatically. Regards, Jozef -- jozef kosoru http://zyzstar.kosoru.com