Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  Erlang Scripts/Binaries.

andreas at ag.or.at
Posted: Fri Dec 18, 1998 2:33 pm Reply with quote
Guest
Hi!

I've been wondering how one can make Erlang scripts/binaries?
Something that can be then run as
./someprog

Another question: Erlang seems to compile to P-code, right? Are there any
native compilers? Or something like python freeze, that allows to pack up
the whole system in one (admittingly huge) binary and sent it someone?

Andreas
--
Win95: n., A huge annoying boot virus that causes random spontaneous system
crashes, usually just before saving a massive project. Easily cured by
UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.



Post generated using Mail2Forum (http://m2f.sourceforge.net)
joe at erix.ericsson.se
Posted: Fri Dec 18, 1998 3:05 pm Reply with quote
Guest
On Fri, 18 Dec 1998, Andreas Kostyrka wrote:

> Hi!
>
> I've been wondering how one can make Erlang scripts/binaries?
> Something that can be then run as
> ./someprog

Not yet - we have done some work in this direction if you look in

http://www.erlang.org/examples/examples-2.0.html

And read the section called "sos" (simple Operating System) you'll see how this
can "almost" be done.

>
> Another question: Erlang seems to compile to P-code, right? Are there any
> native compilers? Or something like python freeze, that allows to pack up
> the whole system in one (admittingly huge) binary and sent it someone?

Again we can almost do this - it can be done for windows95/NT but
not yet for unix. The idea is to build a single shared library and
then a small stub loader that launches the application. Erlang as a
shared library is < 500 KB and the stub loader about 30KB. A single
stand-alone application like "cat" in Erlang works out at about 35KB
for cat.exe and requires you to have a 500 KB dll installed.

This is on our *todo* lists - but we havn't got time to work on it
at the moment.

If there are any volunteers I can send them the code we've got and
and the design and they can start hacking!

/Joe




Post generated using Mail2Forum (http://m2f.sourceforge.net)
tobbe at serc.rmit.edu.au
Posted: Fri Dec 18, 1998 11:51 pm Reply with quote
Guest
> I've been wondering how one can make Erlang scripts/binaries?
> Something that can be then run as
> ./someprog

Dan Sahlin once wrote a little thing to accomplish this (hello
Dan where are you ?).

You also have the 'erl_call' command which is intended to be
used from shell scripts. It makes it possible to start/stop
Erlang, evaluate one/many functions etc. Whatever the Erlang
function in question returns is also returned from erl_call.
Run: erl_call without any switches and a short help with all
the switches is printed.

Exampel:

erl_call -s -a my_module -sname my_node

The -s switch will start a node, -sname specifies the node name: my_node
This will take a few sec. but next time you call erl_call the node
is already started and the communication is really fast. To stop the
node use the -q switch.

> Another question: Erlang seems to compile to P-code, right?

No, JAM code. See the link to Ericsson CSLab and look under
publications to get more info about JAM and BEAM.

> Are there any native compilers?

beam: used to (?) compile to C
gerl: a prototype which implements a subset of Erlang can be
found from the Links page.

Also at the links page, there is a link to Uni.of.Montreal.
Not sure if they compile to native code though.

> Or something like python freeze, that allows to pack up
> the whole system in one (admittingly huge) binary and sent
> it someone?

No.

/Tobbe


Post generated using Mail2Forum (http://m2f.sourceforge.net)
klacke at erix.ericsson.s
Posted: Sat Dec 19, 1998 12:04 am Reply with quote
Guest
Tobbe writes:
>
> > I've been wondering how one can make Erlang scripts/binaries?
> > Something that can be then run as
> > ./someprog
>
> Dan Sahlin once wrote a little thing to accomplish this (hello
> Dan where are you ?).


No no no, what we should have is a program that takes
a {Mod, Fun, Arity} and then traverses the entires module system
and extracts all modules that are reachable from the tripple
{Mod, Fun, Arity}, then packs all this modules into one
large fat chunk and links them with a main() thing that is
linked with a shared object lib which is the entire runtime system.

This should be a really nifty program to have. This way we could
get real standalone executables.

Some tricky stuff with apply(Mod, ...) where Mod is computed.
as well as open_port() calls How does the executable find
a) standalone programs that are run from open_port()
and b) drivers that are to be linked in at runtime.

/klacke





Post generated using Mail2Forum (http://m2f.sourceforge.net)
andreas at ag.or.at
Posted: Sat Dec 19, 1998 6:31 pm Reply with quote
Guest
On Sat, 19 Dec 1998, Claes Wikstrom wrote:
> This should be a really nifty program to have. This way we could
> get real standalone executables.
>
> Some tricky stuff with apply(Mod, ...) where Mod is computed.
It's not that tricky. As this is not really solvable in the general way,
one would have to opt for the python solution: Let the programmer specify
EXTRA arguments. And allow importing of non-compiled in modules.
(Question: How does one import explicitly something? I've only seen the
implicit mod:func notation till now.)

Andreas
--
Win95: n., A huge annoying boot virus that causes random spontaneous system
crashes, usually just before saving a massive project. Easily cured by
UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.



Post generated using Mail2Forum (http://m2f.sourceforge.net)

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum