Vance Shipley <>
Sat May 11 23:40:21 CEST 2002

I can't help but interject at this point on the subject of message
types in erl_interface.  It was asked what a zero length message would
be.  The answer is that there are a number of message types and some
of those messages don't have any payload.  An example is UNLINK.

I have previously reported that you can't determine message type with
erl_interface in R8B.  It's supposed to be in the ErlMessage structure
but it never gets set.

The good news is that if you use the new ei library it does work and 
I suppose that is all that is really necessary at this point.  All new
work we are doing is based on ei and it works well.


-----Original Message-----
[mailto:]On Behalf Of Vance Shipley
Sent: Tuesday, November 13, 2001 5:14 PM
To: Erlang Questions
Subject: ErlMessage emsg; emsg.type == 0

I'm having trouble with erl_interface on R8B.  I'm porting some
code written with the erl_interface library, not ei standalone.

The examples in the tutorial don't work either.  

  ErlMessage emsg;                         /* Incoming message */
	got = erl_receive_msg(fd, buf, BUFSIZE, &emsg);
	if (got == ERL_TICK) {
	/* ignore */
	} else if (got == ERL_ERROR) {
		loop = 0;
	} else {

      if (emsg.type == ERL_REG_SEND) {
      ...                               <-----  *** NOT REACHED ***

In all cases (emsg.type == 0).  If you ignore this there is in fact
a valid message there, the rest of the structure has been filled in
approriately, as far as I can tell.

typedef struct {
  int type;
  ETERM *msg;
  ETERM *to;
  ETERM *from;
  char to_name[MAXREGLEN];
} ErlMessage;


Vance Shipley
Motivity Telecom Inc.
+1 519 579 5816

More information about the erlang-questions mailing list