[erlang-questions] linked-in driver

Bob Cowdery <>
Wed Mar 30 19:22:07 CEST 2011


I've done this before and more or less borrowed the code. However, it
was 4 years ago and clearly I've forgotten something important.

In essence I'm sending something like this to a linked-in driver.
term_to_binary({do_dsp, <<some binary data>>})

I've checked what this gives me in the shell using just <<0>> as the
binary.

I've checked that exactly the same thing arrives at this point in the C
program.
ei_decode_tuple_header(rbuf->buff, &rbuf->index, &arity);

where:
ei_x_buff rbuf;
static void dttsp_port_drv_output(ErlDrvData handle, char *buff, int
bufflen)
{
    rbuf.buff = buff;
    rbuf.buffsz = bufflen;
    rbuf.index = 0;

    ...
}

When I run it I get arity of 0 when it should be 2.

What am I doing wrong?

Bob



More information about the erlang-questions mailing list