[erlang-questions] [ANN] eixx - C++ interface to Erlang

Serge Aleynikov serge@REDACTED
Tue Jan 4 06:31:24 CET 2011


Hi Steve,

Yes it does.  In this project I am using boost's ASIO for asynchronous 
I/O (build around epoll/select/poll depending on the platform), which 
has full support for non-blocking I/O operations.  The combination of 
that with deadline timers allowed implementing support for asynchronous 
receipt of messages in multiple mailboxes in the context of a single thread.

Unfortunately ei is not very friendly on establishing distributed node 
connections in non-blocking way, so I had to copy/paste some code to 
make it work property.  Initially I thought of patching ei, but at some 
point gave up on the idea because it involved to many API changes, and 
just reused the handshaking protocol-related functions.

The project currently only supports client-initiated connections (i.e. 
C++ node connecting to an Erlang node).  If you are coding in C++ rather 
than C, you'll find it quite a time saver - the use of polymorphic 
template-based Erlang terms along with reference counting, and pluggable 
memory allocators gives a rather efficient way of manipulating terms. E.g.:

	eterm term = tuple::make(atom("ok"), 1, 10.0, "string");
	std::cout << term << std::endl;
	// Prints:  {ok, 1, 10.0, "string"}

	std::cout << term.encode(/* header size */ 0) << std::endl;
	// Prints:
	// <<131,104,4,100,0,2,111,107,97,1,70,64,36,0,0,0,0,0,0,107,
	//   0,6,115,116,114,105,110,103>>

Regards,

Serge

On 1/3/2011 10:01 PM, Steve Vinoski wrote:
> Hi Serge, sounds interesting. Does it have a proper event loop, unlike ei?
>
> --steve
>
> On Mon, Jan 3, 2011 at 9:06 PM, Serge Aleynikov<serge@REDACTED>  wrote:
>> http://github.com/saleyn/eixx
>>
>> eixx - Erlang C++ Interface Library
>> ===================================
>>
>> This library provides a set of classes for convenient marshaling
>> of Erlang terms between processes as well as connecting to other
>> distributed Erlang nodes from a C++ application.
>>
>> The marshaling classes are built on top of ei library included in
>> {@link http://www.erlang.org/doc/apps/erl_interface erl_interface}.
>> It is largely inspired by the {@link http://code.google.com/p/epi epi}
>> project, but is a complete rewrite with many new features and
>> optimization enhancements.
>>
>> This library adds on the following features:
>>   - Use of reference-counted smart pointers for complex terms and
>>     by-value copied simple terms (e.i. integers, doubles, bool, atoms).
>>   - Ability to provide custom memory allocators.
>>   - Encoding/decoding of nested terms using a single function call
>>     (eterm::encode() and eterm::eterm() constructor).
>>   - Global atom table for fast manipulation of atoms.
>>
>> The library consists of two separate parts:
>>   - Term marshaling (included by marshal.hpp or eixx.hpp)
>>   - Distributed node connectivity (included by connect.hpp or eixx.hpp)
>>
>> The connectivity library implements a richer set of features than
>> what's available in erl_interface - it fully supports process
>> linking and monitoring.  The library is fully asynchronous and allows
>> handling many connections and mailboxes in one OS thread.
>>
>> Ths library is dependend on {@link http://www.boost.org BOOST}
>> project and erl_interface, which is a part of the
>> {@link www.erlang.org Erlang} distribution.
>>
>> Regards,
>>
>> Serge
>>
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>>
>>


More information about the erlang-questions mailing list