[erlang-questions] Version of beam

Bjorn Gustavsson bjorn@REDACTED
Sat Nov 17 10:27:30 CET 2007

Mickaël Rémond <mickael.remond@REDACTED> writes:

> Hello,
> Is there any function (or description of the beam format) allowing to
> know which version of beam bytecode we are dealing with ?
> The idea would be, given a beam file, to know if it is targetting
> Erlang R10 or R11 for example.

Unless the beam-file has been stripped, the easiest way is to look
at the compiler version number in the informatin returned by:


The same information can be obtained by beam_lib like this if you
don't want to load the module to check its version:

beam_lib:chunks(PathToBeamFile, [compile_info]).

If you must be able to deal with beam-files that have been stripped,
you could extract the "Code" chunk from the beam-file, and look at
the field called "opcode_max" in the header for the code.
(See http://www.erlang.se/~bjorn/beam_file_format.html.)

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list