-
This is the magic macro to initialize a NIF library. It
is to be evaluated in global file scope.
@@ -507,11 +507,14 @@ return term;
the macro.
funcs is a static array of function descriptors for
all the implemented NIFs in this library.
- load, reload, upgrade and unload
- are pointers to functions. One of load, reload, or
+
load, upgrade and unload
+ are pointers to functions. One of load or
upgrade is called to initialize the library.
unload is called to release the library. All are
described individually below.
+ The fourth argument NULL is ignored. It
+ was earlier used for the deprectated reload callback
+ which is no longer supported since OTP 20.
If compiling a NIF for static inclusion through
--enable-static-nifs, you must define STATIC_ERLANG_NIF
before the ERL_NIF_INIT declaration.
@@ -539,7 +542,7 @@ return term;
and there is old code of this module with a loaded NIF library.
Works as load, except that *old_priv_data already
contains the value set by the last call to load or
- reload for the old module code. *priv_data is
+ upgrade for the old module code. *priv_data is
initialized to NULL when upgrade is called. It is
allowed to write to both *priv_data and
*old_priv_data.
@@ -551,27 +554,7 @@ return term;
-
unload is called when the module code that
the NIF library belongs to is purged as old. New code of the same
- module may or may not exist. Notice that unload is not
- called for a replaced library as a consequence of reload.
-
- int (*reload)(ErlNifEnv* env, void**
- priv_data, ERL_NIF_TERM load_info)
- -
-
-
The reload mechanism is deprecated. It was only intended
- as a development feature. Do not use it as an upgrade method for
- live production systems. It can be removed in future releases.
- Ensure to pass reload as NULL to
- ERL_NIF_INIT
- to disable it when not used.
-
- reload is called when the NIF library is loaded and a
- previously loaded library already exists for this module code.
- Works as load, except that
- *priv_data already contains the value set by the
- previous call to load or reload.
- The library fails to load if reload returns
- anything other than 0 or if reload is NULL.
+ module may or may not exist.