<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div><span>Just windows and OSX I would assume. On linux I had to take a different multiprocess approach.</span></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Tuesday, March 6, 2018 12:46 AM, Valentin Micic <v@pharos-corp.com> wrote:<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv0900749191"><div>So… is the same fix, as suggested by Mr Hoguin for OSX, relevant to all three environments then?<div><br clear="none"></div><div><div>V/</div><div class="yiv0900749191yqt7786895167" id="yiv0900749191yqt36911"><div><br clear="none"><div><div>On 05 Mar 2018, at 4:24 PM, Vans S wrote:</div><br clear="none" class="yiv0900749191Apple-interchange-newline"><blockquote type="cite">
</blockquote></div></div></div></div></div><div class="yiv0900749191yqt7786895167" id="yiv0900749191yqt22403"><div><div><div style="color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><div dir="ltr" id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292655"><span id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292660">I realize my mistake right after sending out.  Indeed its related to this, on Windows and OSX you can load two different versions of same lib just fine. On Linux, they symbols will be taken from first loaded lib, and second loaded lib will call symbols from the first loaded lib if the signatures are the same! This was the reason I had erroneous behavior and random segfaults.</span></div> <div class="yiv0900749191qtdSeparateBR" id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292717"><br clear="none"><br clear="none"></div><div class="yiv0900749191yahoo_quoted" id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292721" style="display:block;"> <div id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292720" style="font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px;"> <div id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292719" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292718"><font id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292723" size="2" face="Arial"> On Sunday, March 4, 2018 4:30 AM, Loïc Hoguin <<a rel="nofollow" shape="rect" ymailto="mailto:essen@ninenines.eu" target="_blank" href="mailto:essen@ninenines.eu">essen@ninenines.eu</a>> wrote:<br clear="none"></font></div>  <br clear="none"><br clear="none"> <div class="yiv0900749191y_msg_container" id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292848"><div dir="ltr" id="yiv0900749191yui_3_16_0_ym19_1_1519912327569_292847">If that's on OSX you need the -dynamiclib flag, otherwise functions with <br clear="none">the same name will get overwritten when the second library is loaded, <br clear="none">and this can result in this kind of behavior.<br clear="none"><div class="yiv0900749191yqt5189397881" id="yiv0900749191yqtfd30855"><br clear="none">On 03/04/2018 04:20 AM, Vans S wrote:<br clear="none">> When I load more than 2 nifs in an app, I get total undefined defined <br clear="none">> behavior depending which nif loaded first. Like everything is totally <br clear="none">> messed up.<br clear="none">> <br clear="none">> Example:<br clear="none">> <br clear="none">> LD_PRELOAD="/nif1,so /nif2.so" rebar3 shell<br clear="none">> <br clear="none">> nif1 works, nif2 is totally messed ,and randomly segfaults or gives <br clear="none">> errorneous results.<br clear="none">> <br clear="none">> LD_PRELOAD="/nif2,so /nif1.so" rebar3 shell<br clear="none">> <br clear="none">> Now nif2 works, and nif1 is erroneous.<br clear="none">> <br clear="none">> <br clear="none">> Iv noticed this behavior before I recall, but now its resulted in so <br clear="none">> much frustration. Things were crashing in C++ boost side like<br clear="none">> <br clear="none">> mystruct v = boost::value_initialized<decltype(v)>();<br clear="none">> <br clear="none">> Crash here with "terminate called after throwing an instance of <br clear="none">> 'std::bad_alloc'". Switch the order of the nifs and it works fine.</div><br clear="none">> <br clear="none">> <br clear="none">> _______________________________________________<br clear="none">> erlang-questions mailing list<br clear="none">> <a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">> <a rel="nofollow" shape="rect" target="_blank" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none">> <br clear="none"><br clear="none">-- <br clear="none">Loïc Hoguin<br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="https://ninenines.eu/">https://ninenines.eu</a><div class="yiv0900749191yqt5189397881" id="yiv0900749191yqtfd65553"><br clear="none"></div></div><br clear="none"><br clear="none"></div>  </div> </div>  </div></div></div>_______________________________________________<br clear="none">erlang-questions mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">http://erlang.org/mailman/listinfo/erlang-questions<br clear="none"><br clear="none"></div></div></div><br><br></div>  </div> </div>  </div></div></body></html>