Using Zig to implement an Erlang C Node.
zig master(this was created with the0.11.0-dev.2371+a31450375build), you can just doasdf installin the root folder if you useasdfwith thezigplugin.
From the root directory
$ zig build runThis starts the Zig node.
From another terminal, run a iex shell with:
$ iex --sname fooNow you can connect to the Zig node with (replacing yourhostname with the hostname of the machine
you're executing this example on):
iex> Node.connect(:"zig@yourhostname")And send a message with:
iex> send(:global.whereis_name(:ziggy), {self(), :hello})The Zig node expects message in the format {pid(), atom()}. If you send :ping as atom, the Zig
node will reply to the pid contained in the message with the :pong atom.
iex> send(:global.whereis_name(:ziggy), {self(), :ping})
iex> flush()
:pong
:ok