[erlang-questions] NIF Query

John Duffy <>
Sat Sep 2 01:13:06 CEST 2017


Hi
I'm trying to follow the Interoperability Tutorial Users Guide (Version 9.0) to create a module containing some simple NIFS. I have managed to do this, however I have needed to digress from the documentation as follows...
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).
2.)  The appears to be a "flags" parameter missing in the {"foo", 1, foo_nif} structure in the documentation which generates a compile error...
static ErlNifFunc nif_funcs[] = {
    {"foo", 1, foo_nif},
    {"bar", 1, bar_nif}
};
I have changed this to that below, which compiles, but what is the nature/value of "flags"?
static ErlNifFunc nif_funcs[] = {
    {"foo", 1, foo_nif, 0},
    {"bar", 1, bar_nif, 0}
};
I may be missing something, or the Tutorial may need updating?
Kind regards
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170902/2f11c048/attachment-0001.html>


More information about the erlang-questions mailing list