[erlang-questions] erl_nif environment in the load() function

Michael Uvarov freeakk@REDACTED
Sun Dec 18 12:34:52 CET 2011


Hello,

There is code as example:
https://github.com/beerriot/icu4e/blob/master/c_src/ustring.c

I have few questions:
1. How long is env's lifetime in the load(...)? Will the env be erased
after the call or after module unloading?
2. Is this code valid?

ERL_NIF_TERM ustring_endian(ErlNifEnv* env, int argc,
                            const ERL_NIF_TERM argv[]) {
    return ATOM_ENDIAN;
}

Is the next construction better?

return enif_make_copy(env, ATOM_ENDIAN);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111218/f13311a4/attachment.htm>


More information about the erlang-questions mailing list