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, reload, upgrade, unload): This is the macro that actually creates the NIFs defined in a certain C file. It must be evaluated in the global scope. Normally it will be the last line in the C file.
ErlNifFunc: the type with which each NIF is passed to
ERL_NIF_INITto be exported. This struct is composed of name, arity, a poiter to the C function and flags. An array of this type with all NIF definitions should be created to be passed to
ErlNifEnv: the Erlang environment where the NIF is being executed. It's mandatory to pass the environment as the first argument for every NIF. This type is opaque and can only be manipulated using the functions that the Erlang C API offers.