[erlang-questions] operate C data structure using Erlang

Kannan <>
Mon Apr 16 12:22:17 CEST 2012


Hi Jovi,



Since the communication is in between Erlang and C nodes, you don't have to
worry about marshaling/un-marshaling the data at the Erlang node side. You
can send and receive 'messages' in the 'record tuple' format. But, at the
C node side, you have the work. You will have to hand code
marshaling/un-marshaling routines to populate the Erlang ‘records’ or to
populate the C structures.



It very simple to edit C structures into Erlang records. I don’t think you
will have to invent an interpreter for that. May be, you want to have a
utility to generate marshaling/un-marshaling routines in C, from your C
structures.



If you are familiar with C preprocessor techniques, you can simply write a
reusable module to generate marshaling/un-marshaling routines, and of
course relevant Erlang records, with the help of a ‘definition file’.



Kannan.



On Mon, Apr 16, 2012 at 3:03 PM, Jovi Zhang <> wrote:

> Hi,
>
> Currently I'm working a Erlang project which need send msg represent by C
> language data structure.
> I know that Erlang have record represent by tuple, Is there have any open
> source project aim on resolve this problem?
> generate record format for C data structure automatically? note that there
> have many C data structure need to transform.
>
> There have JSON and protobuf, but none is toward plain C data structure, I
> cannot change the message protocol now because Erlang node need to
> communicate with C node.
>
> .jovi
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120416/ccd40ae5/attachment.html>


More information about the erlang-questions mailing list