Language Bindings for Erlang

Matthias Lang <>
Fri May 26 01:58:22 CEST 2006

Jeff Crane writes:
 > > Start by inventing your own protocol which does a
 > > _subset_ of what you ultimately want

 > Erlang uses a standard protocol, which can implement
 > any communication I desire anyways. Inventing a new
 > protocol sounds ridiculous.

In many cases, inventing a task-specific protocol is easier than
understanding and debugging a general-purpose one.

 > As per interoperability:
 > 1.4.2 C Program
 > On the C side, it is necessary to write functions for
 > receiving and sending data with two byte length
 > indicators from/to Erlang. By default, the C program
 > should read from standard input (file descriptor 0)
 > and write to standard output (file descriptor 1).
 > Examples of such functions, read cmd/1 and
 > write cmd/2, can be found in the file erl comm.c [page
 > 24].
 > Note that stdin and stdout are for buffered
 > input/output and should not be used for the
 > communication with Erlang!
 > ---
 > Given the complexity and vagueness associated with
 > almost all things erlang, it's not surprising to
 > receive conflicting information anymore. I'm not going
 > to bother with that.

The pitfall the note in 4.2 is trying to warn you about is that the C
standard IO streams, i.e. "FILE *stdin" and "FILE *stdout", are
buffered. The particular protocol used in the example won't work very
well in the presence of buffering.


More information about the erlang-questions mailing list