[erlang-questions] Is there anyway to share NIF resource type among NIF modules?
Tue Jan 8 14:20:10 CET 2019
The reasonable way would be to use a ref-counted pointer to struct which
will be shared by both NIF modules. I believe it must also be allocated
somewhere in VM memory in case both NIF modules get unloaded. As C is not
particularly famous for its smart refc pointers, you will have to find a
library or do it yourself, and hook the refc check onto both NIF resource
On Tue, 8 Jan 2019 at 14:11, Lukas Larsson <> wrote:
> On Thu, Jan 3, 2019 at 2:53 PM Wu Ray <> wrote:
>> I have a C struct, as a NIF resource type, and want it to be shared
>> between several NIF modules, is it possible?
> As far as I know it is not possible.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions