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
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 contains the common part of and and
contains the output type. Here I'm trying to hide 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 !


_tags  algo.mlpack

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

#cat algo.mlpack 

let b = ()

let b = Private.a

let b = Private.a

let a = Out.b ;;

Then when I try to compile my library I get : 

#ocamlbuild -classic-display algo.cma
/usr/bin/ocamldep -modules >
/usr/bin/ocamldep -modules >
/usr/bin/ocamldep -modules >
/usr/bin/ocamlc -c -o out.cmo
/usr/bin/ocamlc -c -o private.cmo
/usr/bin/ocamldep -modules >
/usr/bin/ocamlc -c -o pub1.cmo
/usr/bin/ocamlc -c -o pub2.cmo
/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
/usr/bin/ocamlopt -c -o private.cmx
/usr/bin/ocamlopt -c -for-pack Algo -o pub1.cmx
/usr/bin/ocamlopt -c -for-pack Algo -o pub2.cmx
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;
Circular dependencies: "algo.cmx" already seen in
  [ "private.cmx"; "algo.cmx" ]