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
Working on dependent projects with ocamlbuild
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-02 (15:33)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Working on dependent projects with ocamlbuild
Excerpts from Daniel Bünzli's message of Thu Nov 01 11:53:44 +0100 2007:
> Hello,


> But if I use the approach mentionned in my initial posting users of  
> base will see the unconstrained a.cmi and b.cmi. Is there a way that  
> allows me to use this approach while maintaining the abstraction I  
> get with cma's ? Even if it means plugins in p1 and p2 ? I have the  
> impression that the response is negative because even if I try to  
> build a .cma with a mllib the build directory with have all .cmi and  
> the compilers will look at them.

There  is  a  solution  to specify directory scoping in a fine-grained manner.
This way you can explain precisely which directory is seen by a directory.

This  is  done  in  a  plugin  using the function Pathname.define_context that
takes  a  directory  (an  implicit  pathname  starting  from  the root of your
project) and a list of directories seen by it.

You  can then setup your sources in order to confine some files in a directory
only seen by the modules that wrap them.


in p1/
open Ocamlbuild_pack;;
dispatch begin function
| After_rules ->
    Pathname.define_context "src" ["src/implem"]
| _ -> ()

Nicolas Pouillard aka Ertai