caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Circular dependencies
@ 2009-07-06  9:27 Pietro Abate
  2009-07-06 10:25 ` [Caml-list] " Johannes Kanig
  0 siblings, 1 reply; 4+ messages in thread
From: Pietro Abate @ 2009-07-06  9:27 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-06 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-06  9:27 Circular dependencies Pietro Abate
2009-07-06 10:25 ` [Caml-list] " Johannes Kanig
2009-07-06 10:56   ` Pietro Abate
2009-07-06 11:19     ` Johannes Kanig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).