[erlang-questions] Announcing eipp: erlang bindings for c++

Daniel Goertzen goertzen@REDACTED
Thu May 17 04:51:54 CEST 2007


I'm please to announce "eipp": erlang bindings for c++.  My employer 
allowed me to open source this library, so many thanks to 
http://www.norscan.com .

The goal of eipp is to provide a simple, safe, and efficient interface 
to the erlang External Term Format from c++.  This is a work in progress 
(at http://code.google.com/p/eipp/), but what's there now seems to do 
useful work.  An example is worth a thousand words, so below is a 
complete port program example.  The unit tests also provide good 
examples until I can scrape together proper documentation.

Cheers,
Dan.
(comments welcome)


-----------------------------------------
#include <iostream>
#include "eipp.h"
#include "eipp_packet.h"

using namespace eipp;
using namespace std;

int main()
{
    while(1)
    {
        atom_t cmd; // atom type... think std::string
        et data;    // generic "erlang term" type

        // expect tuple of the form {CmdAtom, Data}
        untuple(cmd,data)=binary_to_term(receive4(cin));
       
        // Only one command supported for now...
        if(cmd=="times2")
        {
            int num=data; // "et" can cast itself to many types
            num*=2;
            send4(cout,term_to_binary(tuple("ok",num)));
        }
    }
}
-----------------------------------------



More information about the erlang-questions mailing list