Skip to content

Commit

Permalink
OTP-8335 NIF improvements:
Browse files Browse the repository at this point in the history
          Driver API for multi-threading made available for NIFs.

          Support for mempory managed (garbage collected) resource objects.
          A way to pass "pointers" to native data structures between C and
          Erlang in a safe way.

          Support for references, floats and term comparison.

          Various new functions, like enif_inspect_iolist_as_binary,
          enif_make_sub_binary, enif_get_string, enif_get_atom,
          enif_make_tuple_from_array, enif_make_list_from_array,
          enif_make_existing_atom.
  • Loading branch information
sverker authored and Erlang/OTP committed Feb 17, 2010
1 parent e12a39c commit 69e8c25
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions erts/doc/src/erl_nif.xml
Expand Up @@ -154,10 +154,11 @@ ok
Instances of <c>ErlNifBinary</c> are however always allocated by the user
(usually as local variables).</p>
<p>The raw data pointed to by <c>data</c> is only mutable after a call to
<seealso marker="#enif_alloc_binary">enif_alloc_binary</seealso>.
<seealso marker="#enif_alloc_binary">enif_alloc_binary</seealso> or
<seealso marker="#enif_realloc_binary">enif_realloc_binary</seealso>.
All other functions that operates on a binary will leave the data as read-only.
A mutable binary allocated with <c>enif_alloc_binary</c> must in the end
either be freed with <seealso marker="#enif_release_binary">enif_release_binary</seealso>
A mutable binary must in the end either be freed with
<seealso marker="#enif_release_binary">enif_release_binary</seealso>
or made read-only by transferring it to an Erlang term with
<seealso marker="#enif_make_binary">enif_make_binary</seealso>.
But it does not have do happen in the same NIF call. Read-only binaries
Expand Down Expand Up @@ -781,6 +782,12 @@ typedef enum {
<c>reload</c> or <c>upgrade</c>.</p>
<p>Was previously named <c>enif_get_data</c>.</p></desc>
</func>
<func><name><ret>void</ret><nametext>enif_realloc_binary(ErlNifEnv* env, ErlNifBinary* bin, unsigned size)</nametext></name>
<fsummary>Change the size of a binary.</fsummary>
<desc><p>Change the size of a binary <c>bin</c>. The source binary
may be read-only, in which case it will be left untouched and
a mutable copy is allocated and assigned to <c>*bin</c>.</p></desc>
</func>
<func><name><ret>void</ret><nametext>enif_release_binary(ErlNifEnv* env, ErlNifBinary* bin)</nametext></name>
<fsummary>Release a binary.</fsummary>
<desc><p>Release a binary obtained
Expand Down

0 comments on commit 69e8c25

Please sign in to comment.