[erlang-questions] Passing a C array to the emulator as an ErlIOVec

Vance Shipley vances@REDACTED
Fri Dec 14 22:31:51 CET 2007


I have some drivers which marshall C structs into binaries
and deal with them in erlang.  It's a bit tedious to put
together but I think I've done a good job of having autotools
(autoconf,automake,etc.) handle the portability and some of
the library changes (e.g. changes to array sizes).  The first
thing to be sure of is that you've handled word alignment

An example driver is here:


For each C struct in the API I implement a function:

	foo(#foo{}) -> binary()
	foo(binary()) -> #foo{}

It's tedious to implement bt I've moved between Solaris 32 and 64
and to Linux automatically just by rerunning autotools.

Hope that helps.


More information about the erlang-questions mailing list