[erlang-questions] prep_stop in an included application

Ulf Wiger ulf.wiger@REDACTED
Thu May 21 12:11:41 CEST 2009

Alex Vazquez wrote:
> What sounds weird to me is the fact that start_phases are run for all 
> included applications while prep_stop is only run for the primary 
> application (Am i wrong in this assumption?). I was asking if this 
> behaviour has some reason that i'm unaware of, but, again, thank you for 
> the info.

No, the same rule applies to all callbacks in the application
behaviour. Only the callbacks in the top-level application
are called - never in the included applications. The top-level
application is responsible for calling them when needed.

The AXD 301 project had its own common application callback
that automatically called functions in included applications
based on in-house design rules.

Incidentally, it also had a common function for building the
supervision tree of an application, by fetching child start
specifications from each application's environment
('#ChildSpec#' and '#Supervisor#' variables).

I still think that was a good idea. The original intent was
to avoid having to trace the call chain from the start function
in the application callback, to the init function in some
supervisor callback, just to find out which processes were
started, when the information is statically known 95% of the

Ulf W
Ulf Wiger
CTO, Erlang Training & Consulting Ltd

More information about the erlang-questions mailing list