[erlang-questions] NIF Callback Pids

Roger Lipscombe <>
Tue Sep 29 20:49:29 CEST 2015


On 29 September 2015 at 15:55, Daniel Goertzen
<> wrote:
> I love the Erlang NIF API, but one thing I’ve missed is a nice way to send
> messages into NIF code.

You can do this by simply having an Erlang process that calls the NIF
when it receives a message:

init(Args) ->
    This = my_nif:init(Args),
    State = #state { this = This },
    {ok, State}.

handle_info(Info, #state { this = This } = State) ->
    my_nif:info(This, Info),
    {noreply, State}.

...etc.

 It works pretty well for us. Is there any reason you don't want to do that?


More information about the erlang-questions mailing list