Ad hoc use of a NIF
Harris, Robert
robert.harris@REDACTED
Wed Mar 25 14:30:34 CET 2020
On 24 Mar 2020, at 10:37, Roger Lipscombe <roger@REDACTED> wrote:
>
> On Tue, 24 Mar 2020 at 10:33, Harris, Robert
> <robert.harris@REDACTED> wrote:
>> I was planning to have the make process (called from rebar) for a's NIF
>> use an escript to load it in order to generate b.erl. This doesn't work
>> because, as far as I can tell, I can't load a NIF from the shell.
>
> No, you can't. The module that loads the NIF needs to match the
> declaration in the NIF. More precisely: the name of the calling module
> must match the first argument to ERL_NIF_INIT.
>
> But: you could load 'a' from the shell (or from escript), and invoke
> it that way, no?
Thanks; it's useful to know that what I was trying was impossible.
a and b are both compiled via rebar3; I don't think (but am not
certain) that I can configure the compilation to ensure the correct
order and then interpose between the two.
At the moment I'm using rebar's pre-hooks option to invoke the NIF
compilation, which ensures that I do at least have that before building
the Erlang modules.
Robert
Confidentiality Notice | This email and any included attachments may be privileged, confidential and/or otherwise protected from disclosure. Access to this email by anyone other than the intended recipient is unauthorized. If you believe you have received this email in error, please contact the sender immediately and delete all copies. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
More information about the erlang-questions
mailing list