When writing an Erlang C NIF, how can a pointer, created in C let's say an array, be returned to Erlang for later use by the same Erlang process in another NIF call?
#define LENGTH = 50;
int *a, array[LENGTH];
a = enif_alloc(LENGTH * sizeof(int));
It should be a pointer that can be returned or even stored so that when I return to the NIF from within the same Erlang process I can access the pointer and the memory referenced by it.