10

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.

Hynek -Pichi- Vychodil
  • 26,174
  • 5
  • 52
  • 73
xin zhao
  • 600
  • 2
  • 11

1 Answers1

10

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.

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46