[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Stéphane Glondu <steph@g...> |
| Subject: | Re: [Caml-list] Compiling recursive modules into a .cma. |
Hello, Guillaume Yziquel wrote: > I've been recently trying to compile a module I made. I can load the > .cmo I generate out of it, but not the .cma I generate out of it. > [...] >> # #load "ocaml-yziquel.cma";; >> Reference to undefined global `Protection' >> [...] IIUC, in this .cma, there are (at least) Protection and Chain modules, the latter depending on the former. However: > [...] > Here is the makefile: > [...] >> SOURCE = $(wildcard *.ml) >> [...] >> BYTE_COMPILED_OBJECT = $(SOURCE:.ml=.cmo) >> [...] >> ocaml-yziquel.cma: $(BYTE_COMPILED_INTERFACE) $(BYTE_COMPILED_OBJECT) >> $(OCAMLC) $(PACKAGES) -a -o ocaml-yziquel.cma $(BYTE_COMPILED_OBJECT) >> [...] It seems that chain.cmo is linked before protection.cmo inside the .cma. The order of modules inside of a .cma file is important. The behaviour is the same as if they were #loaded in the same order in a toplevel. Try writing explicitly all .ml files of $(SOURCE) in topological order. Cheers, -- Stéphane