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
ocamlbuild .inferred.mli problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hezekiah M. Carty <hcarty@a...>
Subject: Re: [Caml-list] ocamlbuild .inferred.mli problem
On Mon, 17 Sep 2007, Nicolas Pouillard wrote:

> > I have also tried creating a to get around this, but
> > using something like this in
> > 
> > flag ["use_openin"]
> >   (S [A "-I"; A "+camlp4"; A "-pp"; A "camlp4o pa_openin.cmo"]);;
> You  certainly don't want to add these flags to any commands that treat a file
> that  is  tagged  use_openin.  You  certainly  want to add them only for ocaml
> preprocessing.
> flag ["ocaml"; "pp"; "use_openin"]
>      (A"pa_openin.cmo");;

This gets me a little bit closer I think, but I'm still not able to
make ocamlbuild do what I want.

Here's the current code -
let sum l = open List in fold_left (+) 0 l

"": use_openin
open Ocamlbuild_plugin;;
open Command;;
flag ["ocaml"; "pp"; "use_openin"] (A "pa_openin.cmo");;

Using the above "flag ..." line adds "-pp pa_openin.cmo" to the
compilation command line using the following line in _tags:
"": use_openin

If I change the _tags line to:
"": camlp4o, use_openin

the output from ocamlbuild test.cma is:
+ /home/hcarty/Applications/godi/bin/ocamldep.opt -pp 'pa_openin.cmo
camlp4o' -modules >
sh: pa_openin.cmo: command not found
Preprocessing error on file

How do I fix this to properly use a syntax extension such as
pa_openin.cmo and be able to specify the location of the .cmo, but
only for the files which need that specific extension?  ie. add "-I
+camlp4" to the ocaml* command line, and have the -pp value in the
correct order.

I apologize for asking such a basic question, but I haven't been
able to figure out the answer from the user's guide or other
examples I've found.  Once this is all worked out I would be happy
to add this to a wiki somewhere.