From 69e8c2539ae9232cbd017f4c50d7686d57c863e3 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 17 Feb 2010 17:53:03 +0000 Subject: 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. --- erts/doc/src/erl_nif.xml | 13 ++++++++++--- 1 file 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 ErlNifBinary are however always allocated by the user (usually as local variables).

The raw data pointed to by data is only mutable after a call to - enif_alloc_binary. + enif_alloc_binary or + enif_realloc_binary. All other functions that operates on a binary will leave the data as read-only. - A mutable binary allocated with enif_alloc_binary must in the end - either be freed with enif_release_binary + A mutable binary must in the end either be freed with + enif_release_binary or made read-only by transferring it to an Erlang term with enif_make_binary. But it does not have do happen in the same NIF call. Read-only binaries @@ -781,6 +782,12 @@ typedef enum { reload or upgrade.

Was previously named enif_get_data.

+ voidenif_realloc_binary(ErlNifEnv* env, ErlNifBinary* bin, unsigned size) + Change the size of a binary. +

Change the size of a binary bin. The source binary + may be read-only, in which case it will be left untouched and + a mutable copy is allocated and assigned to *bin.

+
voidenif_release_binary(ErlNifEnv* env, ErlNifBinary* bin) Release a binary.

Release a binary obtained -- cgit v1.2.3