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

Stasik sten.gruener@REDACTED
Mon Nov 3 22:52:58 CET 2008


Hello,

I sill have the problem to get ei working with linked in drivers. My
erl module uses the complex5 structure. http://www3.erlang.org/doc/tutorial/complex5.erl
When I try to implement this tutorial http://www.erlang.org/doc/tutorial/erl_interface.html
to adopt the ei for standalone driver I get many mistakes.

1st problem is, that there is no binary mode.
2nd problem is, LID functions seem to expect signed chars, ei
functions unsigned chars, its ok to workaround this.
3rd problem: even if it compiles with some warnings (regarding signed
ints), erl does not want to start the driver and gives drv_not_loaded
error without further error trace :(

Does someone run ei with lid`s? An example would be very very nice.

Cheers,
Sten Gruener

On Oct 10, 7:14 pm, Hasan Veldstra <hasan.velds...@REDACTED> wrote:
> Check out the ei library:http://www.erlang.org/doc/man/ei.html
>
> 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 athttp://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
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list