[erlang-questions] driver_output works, driver_output_term doesn't

Dave Smith dizzyd@REDACTED
Mon Jan 21 20:49:44 CET 2008

So I wrestled with this recently...things that you might want to check:
* Make sure you're opening the port with binary flag (in erlang)

* Make sure you initialize the port to be binary output
(set_port_control_flags() in the C code)

* The other really important thing is to make sure the tuples/lists
are properly constructed -- if you terminate them incorrectly, the
only way to know is that driver_send_term will fail -- I spent time
digging through the VM source to figure out I was not sending tuples
properly. :)

Those are the big things that stick out in my head... :) Hopefully it helps.


On Jan 20, 2008 4:32 PM, John M. Nordgaard <archevis@REDACTED> wrote:
> Hi all,
> I have written a small linked-in driver which needs to return some fairly
> complex data. So I'd like to use driver_output_term for the job.
> However, I cannot get it to work. More precisely, I never receive a
> response from the C code, even when running this simple example:
>   ErlDrvTermData t[] = { ERL_DRV_ATOM, driver_mk_atom("unknown") };
>   driver_output_term(dd->port, t, size(t) / size(t[0]));
> On the Erlang side 'receive' simply hangs. Strange thing is, replacing the
> above with the following code I do in fact receive a response of [0]:
>   char res = 0;
>   driver_output(dd->port, &res, 1);
> It would seem that dd->port as such should be off the hook at this point,
> given that it works for 'driver_output'. Question is, am I wrong? Or is
> there any other reason why 'driver_output_term' would not work, perhaps a
> missing control flag or some other form of setting?
> My system is Gentoo Linux amd64, running 12B-0 with hipe.
> All suggestions appreciated! :-)
> - john.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list