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
[Caml-list] Module initialiser functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-08-22 (11:27)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: [Caml-list] Module initialiser functions

Is it guaranteed that the initialisers for each module will be run in
the order of modules specified to the ocaml compiler?

Say, with the given Makefile:

ML	 = ocaml/ ocaml/ ocaml/
ocaml/ ocaml/ ocaml/
MLI	 = $(wildcard ocaml/*.mli)
CMX	 = $(

OCAMLKERNEL	= ocaml/ocamlkernel.o

	$(OCAMLOPT) -linkpkg $(CMXA) $(CMX) -output-obj -o $@

For instance: I want to have it such that registers a
device during init, and then registers a device which
depends on opening the keyboard device earlier registered.

But the only way this is guaranteed to work is if I can make some sort
of guarantees about the order that initialisers are called at the
module level. Does ocaml make any sort of guarantees like this? Or
will depending on this to happen be too fragile?