I assume you don't need any external function; otherwise of course you need the binary code providing them.
Yes, the bytecode is resistant to endianness (and to word size), for systems supported by Ocaml.
(however, your bytecode may depend upon the particular version of ocamlrun
interpreter and the Pervasives
module used by your program; hence, a bytecode for Ocaml 4.01 might not run in Ocaml 4.02 runtime or vice versa; YMMV)
In particular when you build Ocaml from its source code, it is compiling itself with a distributed version (in boot/
subdirectory ...) of ocamlc
- which is a bytecode file.
And Ocaml folks badly need that portability, since most of the Ocaml compiler is written in Ocaml itself and is bootstrapped.
See also J.Pitrat's blog on meta-bugs, curse of the bootstrap which indirectly explains why updating that boot/ocamlc
file has to be done rarely and carefully by Ocaml team. Within the Ocaml code, make bootstrap
has to be done occasionally and very carefully (at least to commit a newer version of boot/ocamlc
bytecode file).