[erlang-questions] more than 2 nifs in an app. total screw up?

Vans S vans_163@REDACTED
Sun Mar 4 04:20:43 CET 2018


When I load more than 2 nifs in an app, I get total undefined defined behavior depending which nif loaded first. Like everything is totally messed up.

Example:

LD_PRELOAD="/nif1,so /nif2.so" rebar3 shell

nif1 works, nif2 is totally messed ,and randomly segfaults or gives errorneous results.

LD_PRELOAD="/nif2,so /nif1.so" rebar3 shell

Now nif2 works, and nif1 is erroneous.


Iv noticed this behavior before I recall, but now its resulted in so much frustration. Things were crashing in C++ boost side like 

mystruct v = boost::value_initialized<decltype(v)>();  

Crash here with "terminate called after throwing an instance of 'std::bad_alloc'".Switch the order of the nifs and it works fine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180304/f0c1c204/attachment.htm>


More information about the erlang-questions mailing list