Can I get Erlang OTP behavior in C Nodes?

For example, right now I have a C Node (name it CN ) that connects to erlang Node (name it EN ) and uses RPC to use OTP behavior. Therefore, to send an event from CN to the event manager on the EN , I connect the CN to the EN and execute

args = erl_format("[data_man, {~f, ~f}]", ch.at(0), ch.at(1));
erl_rpc_to(fd, "gen_event", "notify", args);

But then my C Node really doesn't behave like a Node (i.e. why create a Node that uses only remote procedure calls?).

Is there a way to directly use OTP behavior in C Node?

If this does not happen, should I look under the hood in the message formats used by OTP and send messages using this format (i.e. can I spoof OTP behavior?)? I do not like this idea, I will have to follow the changes in the implementation of OTP, etc.

I have strict limits in my requirements, how does this affect my choice of communication between the C process and Erlang (will the RPCs intend to intimidate me, etc.)?

+3
source share
1 answer

It is not possible to directly use the OTP behavior from C. I also do not think you should simulate the OTP behavior in order to use them directly.

RPC, . gen_event-, handle_info/2.

+4

Source: https://habr.com/ru/post/1786716/


All Articles