Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Threads & the order that module initialization code runs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yamagata Yoriyuki <yoriyuki@m...>
Subject: Re: [Caml-list] Threads & the order that module initialization code runs
From: Richard Jones <rich@annexia.org>
Subject: [Caml-list] Threads & the order that module initialization code runs
Date: Tue, 1 Jul 2003 14:34:15 +0100

> It's obviously going to be a problem if the initialization code in
> Network hasn't run by the time the machine threads have been started
> up in Main (or if the network thread itself gets started up first).
> 
> Now it all seems to work, but am I being lucky or do module
> 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