initializing library applications without processes

karol skocik <>
Sat Apr 3 20:17:20 CEST 2010


Hi,
  sometimes, I just need a library "application" without processes,
which works with some state in ETS. To function properly,
they have to make the ETS table and populate it with values
from config files. When that step is done, there is nothing left to do
for processes, they would just serve as a useless proxy for
querying the ETS table, and that's not needed when you can (in some contexts)
access the table directly.

I like the mechanism of applications and their dependency solving,
and I would ideally do application:start(my_app_with_ets_initialised)
but that won't do, since {ok, SupPid} is expected as a result.

But I don't want to start any processes, I just want to ensure that
application_master:init/4 calls my "start" function,
and declare application as "running" when 'ok' is returned
or fail otherwise (unless it's {ok, SupPid} - as it is now).

Currently, when we have library application, application:start(...)
does not call anything since 'mod' is not specified in .app file.
Could it be changed, and application behaviour would just call
start/2 and stop/1 as usual, but start the SupPid optionally when it's supplied?
Or - alternatively - is there any way how to ensure that some init
function is done
fitting nicely with application dependencies as declared in .rel file?

Thanks,
  Karol


More information about the erlang-questions mailing list