<div dir="ltr"><div dir="ltr"><div><div>> You should use a NIF not a BIF.<br></div>Actually i can't use it as i needs internal representation of information from Erlang process which is available only from BIF. NIF hides it from me and i forced to include Erlang sources to NIF code. I don't like it.<span class="gmail-im"><br><br>> You can use `./otp_build update_preloaded`<br></span></div><span class="gmail-im">It works for me. Thank you very much.<br></span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пт, 13 мар. 2020 г. в 02:04, Andrew Thompson <<a href="mailto:andrew@hijacked.us">andrew@hijacked.us</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Mar 12, 2020 at 09:44:11PM +0300, Sergey Loguntsov wrote:<br>
> Hi, everybody.<br>
> <br>
> I tried to implement my own BIF-function which is implemented inside Erlang<br>
> sources.<br>
<br>
You should use a NIF not a BIF.<br>
> <br>
> So i made sources of this function in erts/emulator/beam/bif.c and i have<br>
> changed erts/emulator/beam/bif.tab<br>
> (<br>
> <a href="https://github.com/loguntsov/otp/commit/7a28a3d99b0c7795d956caec5e4e397183dd1ea9" rel="noreferrer" target="_blank">https://github.com/loguntsov/otp/commit/7a28a3d99b0c7795d956caec5e4e397183dd1ea9</a><br>
> )<br>
> i found also i must change erts_internal.erl module in /erts/preloaded/src<br>
> folder.<br>
> So i made it:<br>
> <a href="https://github.com/loguntsov/otp/commit/84c4bfb8c372ade9d92c4a20515f91fe33062b1d" rel="noreferrer" target="_blank">https://github.com/loguntsov/otp/commit/84c4bfb8c372ade9d92c4a20515f91fe33062b1d</a><br>
> <br>
> My problem is .. there are prebuilded files based on erts/preloaded/ebin<br>
> and actually they are not updating every time what i'm building Erlang.<br>
> They are committed as part of sources (seems this is big crutch).<br>
> So my question is what is right way to update preloaded modules (beam<br>
> files) ?<br>
> May be there is another way to have BIF function outside from Erlang<br>
> sources ? and building them together ?<br>
<br>
You can use `./otp_build update_preloaded` if you really want to do this<br>
which will recompile the precompiled beams for you. However be careful<br>
as it will also make a git commit for you(??).<br>
<br>
Andrew<br>
</blockquote></div></div>