<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/048faa0f5ab032b75abc596f2cb84132"
  from="Yamagata Yoriyuki &lt;yoriyuki@m...&gt;"
  author="Yamagata Yoriyuki"
  date="2003-07-01T23:15:10"
  subject="Re: [Caml-list] Threads &amp; the order that module initialization code runs"
  prev="2003/07/5fcbc4efc7f778d847455609a821429f"
  next="2003/07/bbf60d825fc8b08ddc054bb6ccbbeb48"
  prev-in-thread="2003/07/ffad81dd218cf6853f9aa8fb285ee831"
  prev-thread="2003/07/cb5a4b17681aa3d47372f3e2b2c6ece0"
  next-thread="2003/07/4b91558ac368a708608e0af3e7e348f2"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Threads &amp; the order that module initialization code runs">
<msg 
  url="2003/07/17fd8703a229fabb92df42fcba4d10cf"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-07-01T13:34:21"
  subject="[Caml-list] Threads &amp; the order that module initialization code runs">
<msg 
  url="2003/07/ffad81dd218cf6853f9aa8fb285ee831"
  from="Michel Christophe &lt;tofm2@y...&gt;"
  author="Michel Christophe"
  date="2003-07-01T15:24:14"
  subject="Re: [Caml-list] Threads &amp; the order that module initialization code runs">
</msg>
<msg 
  url="2003/07/048faa0f5ab032b75abc596f2cb84132"
  from="Yamagata Yoriyuki &lt;yoriyuki@m...&gt;"
  author="Yamagata Yoriyuki"
  date="2003-07-01T23:15:10"
  subject="Re: [Caml-list] Threads &amp; the order that module initialization code runs">
</msg>
</msg>
</thread>

<contents>
From: Richard Jones &lt;rich@annexia.org&gt;
Subject: [Caml-list] Threads &amp; the order that module initialization code runs
Date: Tue, 1 Jul 2003 14:34:15 +0100

&gt; It's obviously going to be a problem if the initialization code in
&gt; Network hasn't run by the time the machine threads have been started
&gt; up in Main (or if the network thread itself gets started up first).
&gt; 
&gt; Now it all seems to work, but am I being lucky or do module
&gt; initializers run in some sort of well-defined order I can depend on?

The modules are initialized in order of their linking.  You will be
safe if you do
     ocamlc -o program network.cmo ... main.cmo
or 
     ocamlopt -o program network.cmx ... main.cmx

Since you refer Network in Main, the compiler emits an error if
network.cmo is not linked before main.cmo, anyway.

--
Yamagata Yoriyuki

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

