Version française
Home     About     Download     Resources     Contact us    
Browse thread
magic_numbers in config.ml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jianzhou Zhao <jianzhou@s...>
Subject: magic_numbers in config.ml
Hello,

I got an open source code (http://pho.ucsd.edu/liquid/dsolve.tar.gz),
which contains three files, config.mli. config.mlp and config.mlbuild.
After configuration, they generated a config.ml, something like

http://docs.camlcity.org/docs/godisrc/frama-c-Helium-20080701.tar.gz/frama-c-Helium-20080701/why/why-2.13/ml/utils/config.ml

with magic_numbers

let exec_magic_number = "Caml1999X008"
and cmi_magic_number = "Caml1999I010"
and cmo_magic_number = "Caml1999O006"
and cma_magic_number = "Caml1999A007"
and cmx_magic_number = "Caml1999Y011"
and cmxa_magic_number = "Caml1999Z010"
and ast_impl_magic_number = "Caml1999M011"
and ast_intf_magic_number = "Caml1999N010"

At runtime, the code checks if the magic_number matches my local
OCaml. The check fails and returns
   '/usr/lib/ocaml/pervasives.cmi is not a compiled interface'
at runtime.

I usually got this "...cmi is not a compiled interface'" while
compilation if some OCaml objects are compiled by old versions. and
'make clean; recompile' can always solve the problem. But I have no
idea how the number is used and checked at runtime. How can I know
which OCaml to use from these numbers?

-- 
Jianzhou