This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "erl_nif.h" | |
typedef struct private_data_TAG { | |
ErlNifResourceType* res_TYPE; | |
} private_data; | |
static int load(ErlNifEnv* env, void** priv, ERL_NIF_TERM load_info) | |
{ | |
ErlNifResourceFlags flags = (ErlNifResourceFlags)(ERL_NIF_RT_CREATE | ERL_NIF_RT_TAKEOVER); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "erl_nif.h" | |
#include <stdio.h> | |
static int load(ErlNifEnv* env, void** priv, ERL_NIF_TERM load_info) | |
{ | |
int *priv_int = enif_alloc(sizeof(int)); | |
*priv = (void *)priv_int; | |
enif_get_int(env, load_info, priv_int); | |
printf("loaded %i %i\r\n", UNIQ, *priv_int); | |
return 0; |