on_load

Tony Rogvall <>
Sun Dec 6 21:41:01 CET 2009


I am trying the on_load feature.

I did: 

-on_load(auto_start/0).

In a generic server code.

Then I defined auto_start as:

%% called when module is loaded
auto_start() ->
    io:format("auto_start\n"),
    Result = start(),
    io:format("result = ~p\n", [Result]),
    true.


Where start/0 is the normal:

start() ->
    gen_server:start({local, ?SERVER}, ?MODULE, [], []).

Question.

Is this supposed to be working ? Why not?
Currently I get the the "auto_start" output and the the gen_server is registered.
Apart from that it is hanging.


/Tony



More information about the erlang-questions mailing list