<div dir="ltr">thak you for explanation, i will have look at source but now at least i have some orientation</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 22, 2017 at 1:39 PM, Dmytro Lytovchenko <span dir="ltr"><<a href="mailto:dmytro.lytovchenko@gmail.com" target="_blank">dmytro.lytovchenko@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Bifs are registered in special text file located in erts/emulator/beam/bif.tab, based on it an internal C array is generated:<div><br></div><div>1. bif_table which is traversed in beam_emu.c on first start (after init_emulator label) and erts_export_put is called on each table entry to populate exports table.</div><div>2. hash table in nbif_table in hipe_bif0.c that is some HiPE magics i am not familiar with.</div><div><br></div><div>During the load time in beam_load.c function final_touch, the erts_export_put will be called for every export and will return existing export pointing at BIF instead of adding Erlang function version.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-01-21 15:15 GMT+01:00 Karlo Kuna <span dir="ltr"><<a href="mailto:kuna.prime@gmail.com" target="_blank">kuna.prime@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">would this imply that erlang runtime is choosing to call bif if present instead of erlang implemented function ??? is this general case or these<div>"alternative" implementations should be registered somehow somewhere??</div><div><br></div><div>and thak you for the search tip it worked </div></div><div class="m_6771748312083630456HOEnZb"><div class="m_6771748312083630456h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 21, 2017 at 2:38 PM, Dmytro Lytovchenko <span dir="ltr"><<a href="mailto:dmytro.lytovchenko@gmail.com" target="_blank">dmytro.lytovchenko@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div dir="ltr"><span style="color:rgb(0,0,0);font-size:12.8px">Standard library rarely uses dynamic loaded SO/DLL modules (so called NIFs), rather they use BIF functions, code for them is included straight into Erlang/OTP C source and follows different rules than NIF. Have a search through source C files for binary_<function name>_<arity>, with high chance you will find the C source by this name.</span><br></div></span><div class="gmail_extra"><br><div class="gmail_quote"><span>2017-01-21 13:27 GMT+01:00 Karlo Kuna <span dir="ltr"><<a href="mailto:kuna.prime@gmail.com" target="_blank">kuna.prime@gmail.com</a>></span>:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_6771748312083630456m_1291975680353482797h5"><div dir="ltr">I was wandering how is standard module "binary" implemented <div>i am looking at source and i see that most functions are nifs (this makes sense), </div><div>but there is no "-on_load" directive and i can't find c implementation. Please can someone explain to me how is this module using nifs without -on_load directive and also can tell me where is c implementation??</div><div><br></div></div>
<br></div></div><span>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>