[erlang-questions] Re: file operations on zipped files (Re: how to add a module to preLoaded?)

Håkan Mattsson hm@REDACTED
Tue Apr 5 21:03:14 CEST 2011


On Tue, Apr 5, 2011 at 6:29 PM, Kresten Krab Thorup <krab@REDACTED> wrote:
> Can one easily wrap up all of the OTP beams in an ez, and boot from there?
> That would be perfect for erjang. (erjang doesn't need any of the native binaries,
> but do need access to various data files in priv folders).

You can use reltool to build a target system with an ez-file per
application. It can
handle that some sub directories reside, such as ebin,  in the archive while
others, such as priv, reside outside the archive as normal directories.

If you want to have one single archive containing all OTP beams there is no
public support for that. You need to create the ez-file yourself (perhaps with
a little support of the zip module). But for the code loading part, there are
some internal support that you can use as a starting point. The function
code:set_primary_archive(FileName, Binary, FileInfo) will probably do most
of the work for you. You need to invoke it in the early startup before any code
is dynamically loaded. escript uses it to load beams from multi application
archives.

/Håkan



More information about the erlang-questions mailing list