[erlang-questions] beginner: how: problems with starting an application that uses a utility application like stdlib

Chandru <>
Sun Nov 4 02:33:17 CET 2007


On 02/11/2007, Torben Hoffmann <> wrote:
> Hi.
>
> I have created my own little utility application util-0.1 which has simple
> Erlang modules for doing logging (they are implemented as gen_event handlers
> - nothing fancy).
>
> I have an application my_app-0.1 which creates an event manager and then
> uses the two modules from util-0.1 to do logging to either screen or file.
>
> My problem is that I have to start util before I can start my_app like this:
>
> 1> application:start(util).
> 2> application:start(my_app).
>
> When I do the simple thing it looks like this:
> 1> application:start(my_app)
> {error, {not_started,util}}
>
> To the best of my knowledge my util-0.1 application should be exactly like
> stdlib, but I never get complaints about stdlib not being started when I
> start something up.
>

Whenever you start an erlang node, it starts up applications in an
order as specified in a .boot file. By default, it is a file called
start.boot (do a find under your erlang installation and you will see
it).

The .boot file is nothing but an erlang term converted to a binary
(see below). The default start.boot has the applications kernel, sasl
and stdlib. That is why you never see complaints about stdlib not
being started. If you want your own applications automatically
started, you have to create your own boot file. The systools module
has functions to help you do that.

cheers
Chandru

3> {ok, Bin} = file:read_file("releases/R10B/start.boot").
{ok,<<131,104,3,100,0,6,115,99,114,105,112,116,104,2,107,0,15,79,84,80,32,32,65,80,78,32,49,...>>}
4> binary_to_term(Bin).
{script,{"OTP  APN 181 01","R10B"},
        [{preLoaded,[erlang,
                     erl_prim_loader,
                     prim_file,
                     prim_inet,
                     init,
                     otp_ring0]},
         {progress,preloaded},
         {path,["$ROOT/lib/kernel-2.10.6/ebin","$ROOT/lib/stdlib-1.13.5/ebin"]},
         {primLoad,[error_handler]},
         {kernel_load_completed},
         {progress,kernel_load_completed},
         {path,["$ROOT/lib/kernel-2.10.6/ebin"]},
         {primLoad,[zlib,
                    wrap_log_reader,
                    user_sup,
                    user_drv,
                    user,
                    seq_trace,
                    rpc,
                    ram_file,
                    pg2,
                    packages,
                    os,
                    old_file_server,
                    net_kernel,
                    net_adm,
                    net|...]},
         {path,["$ROOT/lib/stdlib-1.13.5/ebin"]},
         {primLoad,[win32reg,
                    timer,
                    sys,
                    supervisor_bridge,
                    supervisor,
                    string,
                    sofs,
                    slave,
                    shell_default,
                    shell,
                    sets,
                    regexp,
                    random|...]},
         {progress,modules_loaded},
         {path,["$ROOT/lib/kernel-2.10.6/ebin","$ROOT/lib/stdlib-1.13.5/ebin"]},
         {kernelProcess,heart,{heart,start,[]}},
         {kernelProcess,error_logger,{error_logger,start_link,[]}},
         {kernelProcess,application_controller,
                        {application_controller,
                            start,
                            [{application|...}]}},
         {progress,init_kernel_started},
         {apply,{application,load,[{application,stdlib|...}]}},
         {progress,applications_loaded},
         {apply,{application,start_boot,[kernel|...]}},
         {apply,{application,start_boot,[...]}},
         {apply,{c,erlangrc|...}},
         {progress,started}]}



More information about the erlang-questions mailing list