Tutorial by Examples

Official documentation: http://erlang.org/doc/tutorial/nif.html NIFs were introduced in Erlang/OTP R13B03 as an experimental feature. The purpose is to allow calling C-code from inside Erlang code. NIFs are implemented in C instead of Erlang, but they appear as any other functions in the scope of ...
Here is a very simple example to illustrate how to write a NIF. Directory structure: nif_test ├── c_src │   ├── Makefile │   └── nif_test.c ├── rebar.config └── src ├── nif_test.app.src └── nif_test.erl This structure can be easily initialized using Rebar3: $ rebar3 new lib nif_...
Official documentation: http://erlang.org/doc/man/erl_nif.html The most important structs, types and macros of the Erlang C API are the following: ERL_NIF_TERM: the type for Erlang terms. This is the return type that NIF functions must follow. ERL_NIF_INIT(MODULE, ErlNifFunc funcs[], load, relo...

Page 1 of 1