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
Camlp4 generate more than one (compiled) files?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-10-17 (11:52)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Camlp4 generate more than one (compiled) files?
On Fri, Oct 17, 2008 at 12:15:08PM +0100, Conglun Yao wrote:
> I'm just wondering is it possible to use camlp4 to generate more than
> one compiled files.
> Normally, camlp4 preprocesses a file and then pass it directly to
> compiler (for *.cmo),  or its pretty-printer (for *.ml or other
> 'plain' file).
> In my case, I want to extend the syntax, and write a file, then
> preprocess (camlp4) it to generate two different *.cmo files, each one
> could be executed separately.
> Is it possible?

Camlp4 extensions can open and write files normally.  However it
doesn't have access to crucial details of the 'OCaml environment' such
as the current search path for libraries, which means that it usually
cannot do anything sensible.

For example, I wanted to load another module/library from a camlp4
extension - but that sort of thing isn't possible as far as I can

I wrote a bit more about this issue here:


Richard Jones
Red Hat