[erlang-questions] Writing c nodes using c interfaces
James Long
longster@REDACTED
Sat Jul 7 18:36:47 CEST 2007
Hey guys,
I'm very new to Erlang, but I like it a lot so far. I have nodes
up and running and communicating, and now the next step is to create a
c node that can seamlessly join this network.
This seemed straightforward at first when looking at the
Interoperability Tutorial from erlang's website
(http://www.erlang.org/doc/tutorial/part_frame.html). Using
erl_interface, I wrote some code to start a c node server. However,
when I tried to connect to it, erl_accept failed, and I couldn't
figure out why.
I did some more research and I found the ei_connect library, and
it looks like that's the newer version of the c interface. Is that
correct? I started rewriting my code to use the ei_* functions,
however there isn't much documentation on them. The only page I could
find is the library reference
(http://web.mit.edu/erlang_vR10B-10/arch/sun4x_510/lib/erlang/lib/erl_interface-3.5.5/doc/html/ei_connect.html).
The only thing I couldn't find on that page is a better explanation
of ei_receive_msg(). The old erl_receive_msg function filled in a
ErlMessage structure which had a member variable 'msg' which contained
the msg. I can't find anything like that in the new erlang_msg
structure that ei_receive_msg uses. Is the message in the ei_x_buff
variable that it takes in, and if so, could someone show my how to use
ei_x_buff as an erlang term? I can't find any documentation on that
structure as it looks to be new.
Here's the new erlang_msg structure, which looks like it's all
information about the message, but no message itself:
typedef struct {
long msgtype;
erlang_pid from;
erlang_pid to;
char toname[MAXATOMLEN+1];
char cookie[MAXATOMLEN+1];
erlang_trace token;
} erlang_msg;
More information about the erlang-questions
mailing list