Version française
Home     About     Download     Resources     Contact us    
Browse thread
Circular dependencies
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pietro Abate <Pietro.Abate@p...>
Subject: Circular dependencies
Hi all,
I've this small compilation problem with ocamlbuild. Basically
private.ml contains the common part of pub1.ml and pub2.ml and out.ml
contains the output type. Here I'm trying to hide private.ml and to 
provide a module algo with only the public interface. If there is a
better way of doing this, I'll be happy to learn. I don't quite get the
circular dependency problem ...

thanks for your help !

Briefly:

#ls
_tags  algo.mlpack  out.ml  private.ml  pub1.ml  pub2.ml

#cat _tags 
<{pub1,pub2,out}.cmx>: for-pack(Algo)

#cat algo.mlpack 
Pub1
Pub2
Out

#cat out.ml      
let b = ()

#cat pub1.ml 
let b = Private.a

#cat pub2.ml 
let b = Private.a

#cat private.ml 
let a = Out.b ;;

Then when I try to compile my library I get : 

#ocamlbuild -classic-display algo.cma
/usr/bin/ocamldep -modules pub1.ml > pub1.ml.depends
/usr/bin/ocamldep -modules private.ml > private.ml.depends
/usr/bin/ocamldep -modules out.ml > out.ml.depends
/usr/bin/ocamlc -c -o out.cmo out.ml
/usr/bin/ocamlc -c -o private.cmo private.ml
/usr/bin/ocamldep -modules pub2.ml > pub2.ml.depends
/usr/bin/ocamlc -c -o pub1.cmo pub1.ml
/usr/bin/ocamlc -c -o pub2.cmo pub2.ml
/usr/bin/ocamlc -pack out.cmo pub1.cmo pub2.cmo -o algo.cmo
Circular dependencies: "algo.cmo" already seen in
  [ "private.cmo"; "algo.cmo" ]
  
as native library :

#ocamlbuild -classic-display algo.cmxa
/usr/bin/ocamlopt -c -for-pack Algo -o out.cmx out.ml
/usr/bin/ocamlopt -c -o private.cmx private.ml
/usr/bin/ocamlopt -c -for-pack Algo -o pub1.cmx pub1.ml
/usr/bin/ocamlopt -c -for-pack Algo -o pub2.cmx pub2.ml
touch algo.mli  ; if  /usr/bin/ocamlopt -pack out.cmx pub1.cmx pub2.cmx
-o algo.cmx  ; then  rm -f algo.mli  ; else  rm -f algo.mli  ; exit 1;
fi
Circular dependencies: "algo.cmx" already seen in
  [ "private.cmx"; "algo.cmx" ]
  

-- 
----
http://en.wikipedia.org/wiki/Posting_style