Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: Merging Modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1996-09-12 (11:17)
From: Xavier Leroy <xleroy@p...>
Subject: Re: Merging Modules

> I have a simple question : can I merge two or more implementation
> files and get only one module (because in the standard case, each
> file define a new module). I want to split a module implementation
> into several files, is it possible ?

The Caml language does not support this. In Objective Caml, you can
have several sub-modules in one input file, but still all the source
code for the top module must reside in one source file.

A possibility is to compile each file as a distinct module (M1, M2, ...),
then have one extra file/module M that re-exports what is made public
to the remainder of the program, which then refers only to M. This is
exemplified in the Caml Light user's manual, chapter on camllibr.

Another possibility is to generate the module implementation from
several input files in your Makefile, using "cat", "cpp", or whatever
external tool does the job.


- Xavier Leroy