[erlang-questions] Different behavior between erl and escript when the string module is used for unicode strings

Per Melin <>
Fri May 1 11:26:24 CEST 2009

Kawatake Chiharu:
> I found that erl and escript behaved differently when the string module was
> used for unicode strings.
> Attached are what I tried to run with erl and escript. I also copied the
> code at the bottom of this e-mail.
> When I did
> %> escript test.erl
> This works fine.
> However, when I used erl to run it, I got an error as follows.
> ------------------
> %> erlc test.erl
> %> erl -noshell -s test main -s init stop
> {"init terminating in
> do_boot",{undef,[{test,main,[]},{init,start_it,1},{init,start_em,1}]}}

The error {undef,[{test,main,[]}, ...]} actually tells you what the
problem is; there is no function 'main' in the module 'test' with
arity zero (i.e. test:main/0).

You can either start your program like this:

erl -noshell -s test main "" -s init stop

...or add this to your code:

main() -> main([]).

...and it should work.

More information about the erlang-questions mailing list