[erlang-questions] FFI Interface - Limitation of the size of parameters

Hasan Veldstra hasan.veldstra@REDACTED
Fri Oct 10 21:14:38 CEST 2008

Check out the ei library:

You can use the term_to_binary function on the Erlang side on any  
term and then decode that in C using functions in ei. It works the  
other way round too.

On 10 Oct 2008, at 17:30PM, Stasik wrote:

> Hello,
> I am quite new to Erland, and try to get some Erlang-C Communication.
> I found a tutorial at http://www.wagerlabs.com/blog/2008/02/erlang- 
> ffi---in.html
> (which is a commented version of another tutorial, but it does not
> matter). Well, I was successful to compile the example and its pretty
> fine, BUT: I noticed that all exchanged parameters in port_driver.c
> are chars i.e.:
> - static void example_drv_output(ErlDrvData handle, char *buff, int
> bufflen) //here the input array consists of chars
> - driver_output(d->port, &res, 1); //here &res should point to a char,
> driver_output is a predefined function in erl_driver.h
> These limitations do not allow to send and receive any values which
> are bigger then 255 (and I do not want to split bigger numbers in
> bytes if there is a possibility to do it elegantly).
> Well, is there a known solution for that problem? I would like to have
> an int range.
> Cheers,
> Sten Gruener

More information about the erlang-questions mailing list