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
Bytecode object files structure
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre-Etienne Meunier <pierreetienne.meunier@e...>
Subject: Bytecode object files structure

I'm trying to decrypt .cmo files produced by simple programs, such as
print_string "string";;
List.length [1;2;3;4;5];;

According to the source of Ocaml, there's something called the 
"cmo_magic_number", systematically written at the beginning of all .cmo 
files. Does it have a real function for executing the programs, or is it just 
a way to make sure the file contains ocaml bytecode ?

Then, there's the address of what seems to be the last bytecode instruction.
Then, the bytecode instructions, as documented in

After that, I can't understand anything : there vaguely seems to be some 
information related to linking or so... What is the precise structure of this 
part ? Is there some kind of a bytecode assembler ?

P.E. Meunier (