tags:

views:

287

answers:

2

I have a temporary situation where beam files compiled on one node are executed on another node. Are the beam files portable?

How close do the versions of the Erlang distributions need to be?

+7  A: 

Beam files are portable across nodes, as they are bytecode that is interpreted by the Erlang VM, in the same way that Java works. The exception is if they're compiled for native optimization (+native), in which case they're obviously not very portable, other than possibly between windows machines.

Version wise, it's obvious that you shouldn't use features that the oldest version doesn't support. As long as the features are supported, it should work even if the version gap is big.

Note also that some modules may have been experimental in earlier versions, and so their functions may have had slightly different results.

Tor Valamo
Thanks for your answer and your time. Are any path names "hardcoded" into the beam file?
DanM
only if you specify path names in it.
Tor Valamo
+5  A: 

Beam files should be fairly portable across nodes. If nodes are running different versions of the Erlang VM, then you might have troubles. Features to be especially wary of include the use of parameterized modules and the -extends() module attribute. If one of the machines is running a VM that was installed via a package manager (i.e. apt), it's probably old. One module that I've had difficulty with in the past is the regular expression module re.

cbo