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
magic_numbers in
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-11-13 (22:10)
From: Jianzhou Zhao <jianzhou@s...>
Subject: magic_numbers in

I got an open source code (,
which contains three files, config.mli. config.mlp and config.mlbuild.
After configuration, they generated a, something like

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?