[erlang-questions] on_load behaviour in OTP 20

Caragea Silviu <>
Sat Jul 8 20:40:50 CEST 2017


Sorry profile doesn't matter. The one that meters is Code Loading Strategy
: In OTP < 20 both -mode interactive and -mode embedded works In OTP20 only
-mode interactive works

Silviu


On Sat, Jul 8, 2017 at 9:21 PM, Caragea Silviu <> wrote:

> Hello,
>
> In some of my projects I have modules dynamically compiled. In order to
> avoid static analyzers warning I had used a stub module. And also in order
> to avoid when doing hot-swap releases to have the stubs reloaded and
> overwriting the code I used on_load that returns something different than
> ok.
>
> Unfortunatly this seems no longer working in OTP 20 as time : In embedded
> mode, first all modules are loaded. Then all on_load functions are
> called. The system is terminated unless all of the on_load functions
> return ok.
>
> My stub is as follow:
>
> -module(erlpool_globals).
>
> %% Module stub.
> %% Will be replaced by the module with the same name at runtime.
> %% The only purpose for the module is to suppress warnings from code analyzers,
> %% as dynamically compiled module is not available during the build.
>
> -export([]).
>
> -on_load(do_not_load/0).
>
> do_not_load() ->
>     do_not_load.
>
> In OTP < 20 works fine. In 20 is not. The app crashes at startup if the relase is done using
> {profile, standalone}, or  {profile, embedded}
>
> Any workarounds ?
>
> Silviu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170708/f673f894/attachment.html>


More information about the erlang-questions mailing list