Skip to content

rbino/zig_cnode_poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zig Erlang C Node PoC

Using Zig to implement an Erlang C Node.

Prerequisites

  • zig master (this was created with the 0.11.0-dev.2371+a31450375 build), you can just do asdf install in the root folder if you use asdf with the zig plugin.

How to use

From the root directory

$ zig build run

This starts the Zig node.

From another terminal, run a iex shell with:

$ iex --sname foo

Now 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

About

An Erlang C Node implemented with Zig

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages