Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlbuild and installed modules and libraries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] ocamlbuild and installed modules and libraries
Excerpts from daniel.buenzli's message of Sun Nov 16 19:22:02 +0100 2008:
> Hello,
> 
> Is it possible to specify a single installed module (instead of a lib)  
> for link time ? That is is there something like -lib but for module so  
> that I can type :
> 
> ocamlbuild -I +xmlm -mod xmlm test.native
> 
> where test.ml uses the xmlm module

This would make sense, but I would prefer not to push things in this
direction. Options like -lib,-cflag,-lflag... are intended to be used
only in a quick hack usage, indeed they are global and tags are much
more powerful.

> And what about having special tags use_lib_$LIB and use_mod_$MOD that  
> automatically create rules to use libraries $LIB.cm(x)a and module  
> $MOD.cm(o|x) so that just the appropriate -I to find the files has to  
> be specified. In most cases having to use a plugin just for that seems  
> overkill. Or is there another way ?

I'm a bit uncomfortable with this kind of dynamic or special tags.

However the simplest solution to your problem is probably one of those:

  1/ ocamlbuild -cflags -I,+xmlm,xmlm.cmx test.native

  2/ ln -s <sources-of-xmlm> xmlm
     ocamlbuild -I xmlm test.native

  3/ ln -s $(ocamlc -where)/xmlm .
     ocamlbuild -tag_line '"xmlm": not_hygienic' -I xmlm test.native

Hope that helps,

-- 
Nicolas Pouillard aka Ertai