summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-01-05 22:41:06 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-01-05 22:41:37 +0100
commitb594d356e1fb927e28ce0b285bb39b3e472a3897 (patch)
treee45acc9d0f818734df1ef153de6341ef2043c86a
parentaf3eab652259260b139456807557342ae4876e54 (diff)
Fix basic_nif on_load()
-rw-r--r--priv/templates/basicnif.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/priv/templates/basicnif.c b/priv/templates/basicnif.c
index a4a65be..a1aa9e9 100644
--- a/priv/templates/basicnif.c
+++ b/priv/templates/basicnif.c
@@ -1,6 +1,6 @@
#include "erl_nif.h"
-static ErlNifResourceType* {{module}}_RESOURCE;
+static ErlNifResourceType* {{module}}_RESOURCE = NULL;
typedef struct
{
@@ -51,6 +51,8 @@ static int on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
if (rt == NULL)
return -1;
+ {{module}}_RESOURCE = rt;
+
return 0;
}