Can't send a long from a driver?

Vance Shipley vances@REDACTED
Thu Aug 21 08:53:52 CEST 2003

It seems the "driver term format" does not include support for
integers greater than a signed int.  To send an integer in from
a driver you can do this:

    ErlDriverTermData reply[] = {
            ERL_DRV_INT, 100,

    driver_output_term(port, reply, (sizeof(reply) / sizeof(reply[0]));

Despite the fact that ErlDriverTermData is actually an unsigned long
If you try and send a long driver_output_term() will return -1 and the
term won't be received.

There are probably a few things missing from this list:

    Term type            Argument(s)
    ERL_DRV_NIL          None
    ERL_DRV_ATOM         driver_mk_atom(string)
    ERL_DRV_INT          int
    ERL_DRV_PORT         driver_mk_port(ix)
    ERL_DRV_BINARY       ErlDriverBinary*, int len, int offset
    ERL_DRV_STRING       char*, int len
    ERL_DRV_TUPLE        int size
    ERL_DRV_LIST         int size
    ERL_DRV_PID          driver_connected,...
    ERL_DRV_STRING_CONS  char*, int len

I was beginning to panic but I realized that I can always send in a
binary and make it into what I need on the other side.  This is however 
rather kludgy for something as simple as an unsigned long (my current
dilema).  The strange thing is that ErlDriverTermData is actually an
unsigned long!


More information about the erlang-questions mailing list