[erlang-questions] Stand Alone Erlang or Equivalent

Thomas Lindgren <>
Sat Sep 8 13:13:01 CEST 2007


--- Benjamin Tolputt <> wrote:


> There is also "standard practice" to consider. As I
> mentioned in another 
> email - the standard practice for game deployment is
> a small number of 
> large archive files. By enabling the code to be
> extracted from a zip or 
> other archive - there is a single "bottleneck" in
> the code that can be 
> altered to other archive file formats (encrypted or
> otherwise).
> 
> The point *I* am trying to make is that enabling a
> single file (or 
> perhaps double "exe + archive" file) distribution
> enables the game 
> developers to get past the above "commercial
> hurdles", while also giving 
> the other developers asking for single/dual file
> deployments what they 
> desire.

Storing multiple beam files in a single archive has
been done at least three times that I know of. Here is
a simple fourth approach (untested, of course):

* compile your modules into binaries M1,...,Mn
  (compile:file(...,[...,binary,...]) should do it)

* create an archive:

   Bin = term_to_binary([{mod1,"file1",M1},...]),
   file:write("archive", Bin)

* at startup, load the code manually:

  {ok, Archive} = file:read_file("archive"),
  [ code:load_binary(Mod, File, Code)
   || {Mod, File, Code} <- binary_to_term(Archive) ]

Note that this requires some code to be present to
bootstrap, and sucks a big binary into the system. But
you can see the principle.

The beam emulator contains some precompiled bytecode
too, if memory serves. I'm not sure how that is
generated in detail, but you might be able to use the
same mechanism.

Best,
Thomas



       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC



More information about the erlang-questions mailing list