Newbie compilation question

Ulf Wiger ulf.wiger@REDACTED
Tue Dec 22 14:49:24 CET 1998


One way to spawn processes that will actually give more info is

proc_lib:spawn(Mod, Function, Args).

I was going to run it myself to show how well it works, but first i had to
download OS Erlang to my home PC. Unfortunately, it's not a complete
installation - among other things it lacks the SASL application, which I
think is the one that displays pretty error messages.

Not to be easily deterred, I downloaded the tar file with all the libraries
and unpacked it, only to find that the libraries were not compiled! No big
deal on a unix box, but I feel a bit crippled on this #¤%# windoze piece of
crap.

I gave it a try, only to receive an error message from erlc that it didn't
recognize the macro '-vsn'... !?!??

Am I the only one wanting a full Erlang installation for Windows? Or am I
just the only one who's too stupid to figure it out? Why aren't all
libraries included from the start?

/Uffe

-----Original Message-----
From: Claes Wikstrom <klacke@REDACTED>
To: Mark NG <markn@REDACTED>
Cc: erlang-questions@REDACTED <erlang-questions@REDACTED>
Date: den 18 december 1998 11:00
Subject: Newbie compilation question


>
>Mark NG writes:
> >
> >
> > Hallo !
> >
> >
> > When I was writing a program I wrote "list:append/2" in my code instead
of
> > the correct one - "lists:append/2".  The compiler fail to notify me of
that
> > and when I ran it by spawning a process  it just dies out quitely...
> >
> > I had to use the Process Manager's tracing facility to find out that it
> > is due to a missing 's' in the function call !
> >
> > So, my questions is
> > 1) How can I make the compiler (I am using c:c/1) notify me of undefined
> >    symbols ?
>
>This we simply cannot do. All references to modules and functions are
>resolved at runtime. There is no link phase at all !!!
>This is so since we want to be able to load code in the running system
>in a flexible way.
>
> >
> > 2) How can I get the error messages of a spawn proces to appear on the
shell ?
> >
>
>This can be done, but it's not easy. This is what happens:
>
>1. The runtime system creates an new process.
>2. The process start to execute.
>3. The runtime system sees a call to list:append/2 (miss spelled)
>4. The runtime system realizes that no module named 'list' is loaded
>   so insted it invokes nother module called the error_handler
>
>   Thus the call to list:append(X,Y) is transformd into a call
>   error_handler:undefined_function(list, append, [X, Y])
>
>   This error_handler module resides in kernel/src/error_handler.erl
>
>   The error_handler (in kernel/src) will ask the code server to
>   search the load_path and try to load a module called list.jam
>
>   If this failes, the error_hanler simply does a call to
>   exit({undef,{Module,Func,Args}})
>
>   Which will silently exit te process.
>
>However in an environment where we sit and develop we could
>sometimes want to have a different behaviour there, for example
>print a little friendly something on stdout saying that we can't find
>the module list.erl
>This is bad default behaviour though.
>
>As an exercise you could try to modify the error_handler to do
>just that and then (maybe in your ~/.erlang) load your own
>error_handler instead of the systems.
>
>I know that Arndt Jonason has done just that, he is running
>some weird error_handler that tries to correct misspelleded
>modules at runtime !!
>
>You can also give the -pa Dir flag to 'erl' and point it
>to a directory where a different error_handler resides.
>
>Cheers
>
>/klacke
>
>




More information about the erlang-questions mailing list