[erlang-questions] More NIF on github

14 views
Skip to first unread message

Sverker Eriksson

unread,
Dec 9, 2009, 8:08:00 AM12/9/09
to erlang-questions
Some new NIF features pre-released on http://github.com/erlang/otp
(branch ccase/r13b04_dev):

INCOMPATIBLE changes:

* Function prototypes of all NIFs changed to argc-argv style:

ERL_NIF_TERM my_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])

The purpose is to allow more than 3 function arguments but it's also
turns out to be good for performance.
You need to go through all your NIFs and change the function
prototype as well as refer to argv[N-1]
(for the Nth argument) instead of named argument variables.

* erlang:load_nif has changed return value on failure from {error,A,S}
to {error,{A,S}}


New API functions:

enif_make_double, enif_get_double
enif_make_ref, enif_is_ref
enif_make_existing_atom
enif_is_atom
enif_is_identical
enif_compare
enif_get_tuple

Read more in erts/doc/src/erl_nif.xml.

/Sverker, Erlang/OTP Ericsson


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Sverker Eriksson

unread,
Dec 9, 2009, 8:18:33 AM12/9/09
to erlang-questions
I wrote:
>
> The purpose is to allow more than 3 function arguments

The purpose yes, the ability no. It just hit me that I had not removed
the sanity check for max 3 arguments.

What's not tested doesn't work.
I'll be back.

Sverker Eriksson

unread,
Dec 9, 2009, 9:11:33 AM12/9/09
to erlang-questions
Now improved... to actually work:
Reply all
Reply to author
Forward
0 new messages