[erlang-questions] RFC: Erlang FFI
Vlad Dumitrescu
vladdu55@REDACTED
Thu Aug 9 08:59:52 CEST 2007
Hi,
On 8/9/07, Eric Merritt <cyberlync@REDACTED> wrote:
> It would seem that providing the 'safe' version would mean just coming
> up with a simple protocol and implementing a very thin c program that
> translates that protocol to libffi calls. Then talking to said c program
> via pipes or what have you. This should give you the best of both worlds
> at some cost in speed but a huge increas in reliability.
That is indeed one of the best ways to interface to the outside world
from Erlang. The trouble is that while it is relatively easy (i.e.
there are tools to automate it) to take some C headers and generate
wrappers, it isn't as straightforward to come up with an efficient
protocol implementation that is generic[*]. (Or at least I'm not aware
of any, the closest match I can come up with would be the eX11
bindings) In the meantime, the developers for each library binding are
going to have to implement their own protocol and supporting code.
Which imho is a big pain...
[*] One issue I see is that given an API, it would need to be
annotated so that one knows which arguments are "in" and which are
"out", because "in" parameters can be serialized and sent in full
instead as as a pointer, significantly reducing the communication
overhead.
[*] Then, as Scott pointed out, memory management issues are also to
be considered.
best regards,
Vlad
More information about the erlang-questions
mailing list