[erlang-questions] best practice for calling C from Erlang

Alexey Romanov <>
Mon Dec 13 17:07:54 CET 2010


Erlang Driver Toolkit (http://www.snookles.com/erlang/edtk/) seems
like it should fit the bill, but
1) it accepts bindings description in XML;
2) I don't think it is maintained anymore (though I could be wrong);
3) I haven't used it personally.

Yours, Alexey Romanov



On Mon, Dec 13, 2010 at 4:37 PM, Joe Armstrong <> wrote:
> What is "best practice for calling C from Erlang"
>
> I have a C library I want to call from Erlang - nothing complicated.
> Mostly the C functions are called with simple types, integers, strings etc.
> and the return value is uninteresting. In the case where the return value is
> interesting I mostly require an opaque return value - ie all I might
> ever want to do
> is re-use it in a subsequent call to a different C routine, so the actual return
> value need never cross the C/Erlang boundary, but could be passed back
> and forth
> as a reference.
>
> What is the best (and easiest) way to call this from Erlang.
> Is there any program that takes a file containing C type declarations
> (either in ANSI C, or as a erlang terms) and automatically builds
> the C and Erlang sides of the interface?
>
> The problem here is not the complexity of an individual
> call, but the fact there are a large number of simple and rather
> boring functions than must be called.
>
> I know all about the ports
> interface linked-in drivers etc. My question is more to do with
> the automatic generation of an interface from some kind of specification.
>
> /Joe
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list