[erlang-questions] NIF Query

John Duffy <>
Sat Sep 2 21:32:02 CEST 2017


Thanks for your reply. My issues were caused by not specifying the module name correctly in the first argument to ERL_NIF_INIT() and a gcc compiler option "-W" which was generating the uninitialised structure field warning.

Kind regards


----Original message----
>From : 
Date : 02/09/2017 - 20:17 (BST)
To : 
Cc : 
Subject : Re: [erlang-questions] NIF Query

On 2 September 2017 at 00:13, John Duffy <> wrote:
> 1.)  if my module name doesn't match the filename in the call to
> erlang:load_nif("filename", 0) I get a compile error. This is not as per the
> example in the documentation, i.e. -module(complex6) &
> erlang:load_nif("complex6_nif, 0).

I don't see how you'd get a *compile* error. Could you clarify?

I *have* noticed that the name of the calling module (i.e. the .erl
file) must match the name of the NIF as provided in the first argument
to ERL_NIF_INIT. That doesn't appear to be documented anywhere. Also
note that Erlang will implicitly add the ".so" extension when you call

More information about the erlang-questions mailing list