tags:

views:

216

answers:

2

I have an erlang server that will be communicating via tcp sockets with a client written in C. Are there any C libraries for parsing erlang binary terms to C structs?

I realize this is not absolutely necessary, but it would be very convenient.

+3  A: 

There are C libraries for interprocess communication between Erlang and C, erl_interface and C Nodes:

Thilo
Where would you download the C files required for this to work?
mindeavor.
+2  A: 

I've crafted my own: EPAPI (Erlang Port API) in C/C++. Very easy to use and I provide a Debian repo for easy updates.

Example

 PktHandler *ph = new PktHandler();
 MsgHandler *mh = new MsgHandler(ph);

 //Register a message type
 // {echo, {Counter}}
 mh->registerType(1, "echo", "l" );

 //Wait for a message
 Msg *m;
 result = mh->rx(&m);

 //Verify return code
 if (result) {
    //handle error
    printf("ERROR, message: %s", mh->strerror());
    // ...
 }
jldupont