[erlang-questions] Code mobility by message passing

Jachym Holecek freza@REDACTED
Sun Oct 30 11:23:45 CET 2011


# M4rk1x 2011-10-30:
> I wrote this code, which happens to work only if the server and the
> client are compiled in same directory.
> If i try to compile the client in another directory it'll work.
> Load_library should send the code properly, in fact if i use the spawn
> function it works, but i wouldn't want to use that.
> 
> http://pastebin.com/GBaXLqYp
> 
> Obviously, is not what i wish.
> do you know what the problem could be?

Not sure I quite see what you mean, but:

  22.    rpc:call(element(1, server ()), code, load_library, [Mod, Filename, Bin])
  24.    rpc:call(element(1, W), code, load_library, [Mod, Filename, Bin])

Did you mean code:load_binary/3 there perhaps? I can't see load_library/3
on R14B04. You can pattern-match on return values to expose this kind of
unexpected failures:

  {module, _} = rpc:call(Node, code, load_library, [Mod, Filename, Bin])

BR,
	-- Jachym



More information about the erlang-questions mailing list