[erlang-questions] compile several modules from shell

Joe Armstrong erlang@REDACTED
Tue Dec 1 16:02:27 CET 2009


On Tue, Dec 1, 2009 at 3:34 PM, Roberto Ostinelli <roberto@REDACTED> wrote:
>> What you are really asking is "how can I change the default commands
>> in the shell?"
>
> hello joe,
>
> thank you for the refreshing explanation on this, however i did read
> your book :)
>
> what i'm really asking is:
>
> "if i change code and re-compile a module on a local erlang node, what
> must i do so that the newly re-compiled .beam is also reloaded in
> another local erlang node?"
>
> :)
>
> therefore: must i understand from your answer that the only way is to
> actually use rpc and other procedures to refresh the code on all
> nodes?

I think so - I'd use code:purge(Mod) and  load_binary(Module,
Filename, Binary) to be sure

do something like:

    rpc:call(Node, code, purge, [Mod]),
    rpc:call(Node, code, load_binary, [Mod,FileName, Bin])

You can also compile directly to a binary by adding the atom binary to
the compile options, thusly:

   {ok, Mod, Bin} = compile:file(File, [..., binary, ....])

/Joe


>
> r.
>


More information about the erlang-questions mailing list