How to call a fun from a NIF?

,

When we wrote Erlang.NET early last year, we “needed” a way for VB.NET (or C#) to synchronously call functions in Erlang in quite a few places, so this is the means we came up with

The resource is sent up to Erlang using an enif_send, we then do a spin on the result - which then written into the resource by the Erlang and the function can proceed and the result can be returned.

This is not the best way, it’d be best to design the code as stated above (keep an state accumulator and repeatedly invoke the C with it), but if that’s not an option…

4 Likes