<div dir="ltr"><div>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<br><br></div>Silviu<br><div><br><br><div class="gmail_extra"><div class="gmail_quote">On Sat, Jul 8, 2017 at 9:21 PM, Caragea Silviu <span dir="ltr"><<a href="mailto:silviu.cpp@gmail.com" target="_blank">silviu.cpp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hello, <br><br></div>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.<br><br></div><div>Unfortunatly this seems no longer working in OTP 20 as time : In embedded mode, first all modules are loaded.
      Then all <span class="gmail-m_-3929691038678178108gmail-code">on_load</span> functions are called. The system is
      terminated unless all of the <span class="gmail-m_-3929691038678178108gmail-code">on_load</span> functions return
      <span class="gmail-m_-3929691038678178108gmail-code">ok</span>.<br><br></div><div>My stub is as follow:<br></div><div><br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">-module(erlpool_globals)<span style="color:rgb(0,0,128);font-weight:bold">.<br></span><span style="color:rgb(0,0,128);font-weight:bold"><br></span><span style="color:rgb(128,128,128);font-style:italic">%% Module stub.<br></span><span style="color:rgb(128,128,128);font-style:italic">%% Will be replaced by the module with the same name at runtime.<br></span><span style="color:rgb(128,128,128);font-style:italic">%% The only purpose for the module is to suppress warnings from code analyzers,<br></span><span style="color:rgb(128,128,128);font-style:italic">%% as dynamically compiled module is not available during the build.<br></span><span style="color:rgb(128,128,128);font-style:italic"><br></span>-export([])<span style="color:rgb(0,0,128);font-weight:bold">.<br></span><span style="color:rgb(0,0,128);font-weight:bold"><br></span>-on_load(do_not_load/<span style="color:rgb(0,0,255)">0</span>)<span style="color:rgb(0,0,128);font-weight:bold">.<br></span><span style="color:rgb(0,0,128);font-weight:bold"><br></span>do_not_load() -><br>    do_not_load<span style="color:rgb(0,0,128);font-weight:bold">.</span></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">In OTP < 20 works fine. In 20 is not. The app crashes at startup if the relase is done using <br>{profile, standalone}, or  {profile, embedded}<br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">Any workarounds ?<span class="gmail-HOEnZb"><font color="#888888"><br><br></font></span></pre><span class="gmail-HOEnZb"><font color="#888888"><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">Silviu<br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(0,0,128);font-weight:bold"></span></pre></font></span></div></div>
</blockquote></div><br></div></div></div>