Calling Erlang functions from NIF
Asked Answered
O

1

11

Is it possible to call Erlang functions (callback funs) from NIFs?

I read the doc(http://www.erlang.org/doc/man/erl_nif.html), but didn't find how to do that.

Oogonium answered 24/12, 2015 at 2:46 Comment(3)
There seem to be some relevant hits when I try call erlang nif web search - do any of those give useful info?Desma
erlang.org/pipermail/erlang-questions/2018-January/094626.htmlLamoree
See erlangforums.com/t/how-to-call-a-fun-from-a-nif/915Folia
E
11

No, calling an Erlang function from a NIF isn't possible. You can either implement your functionality in an Erlang function that calls into a private NIF that returns a value indicating whether or not invoking a callback is necessary, or perhaps you could instead send a message to another process using enif_send and have it call the callback function for you.

Entrench answered 24/12, 2015 at 3:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.