aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2010-02-17 17:53:03 +0000
committerErlang/OTP <[email protected]>2010-02-17 17:53:03 +0000
commit69e8c2539ae9232cbd017f4c50d7686d57c863e3 (patch)
treeb4aaf1f4ff9f8bc1450fa67bd2c7fd723af0312a /erts
parente12a39c6fa4981ad4e84d4e6aebf6a2cbab5c843 (diff)
downloadotp-69e8c2539ae9232cbd017f4c50d7686d57c863e3.tar.gz
otp-69e8c2539ae9232cbd017f4c50d7686d57c863e3.tar.bz2
otp-69e8c2539ae9232cbd017f4c50d7686d57c863e3.zip
OTP-8335 NIF improvements:
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.
Diffstat (limited to 'erts')
-rw-r--r--erts/doc/src/erl_nif.xml13
1 files changed, 10 insertions, 3 deletions
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 2e55f13ed5..0dd46a951a 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -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
@@ -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