[erlang-questions] Version management.
Bob Cowdery
bob@REDACTED
Sat Jan 14 20:20:41 CET 2012
Hi
I'm trying to get a driver that worked in 5.8 to load in 5.9. As far as
I can tell there are two changes to make. The return value from the
callbacks and version info. I've made both changes but still it does not
load. I'm using the 32 bit version as I failed to figure out how to link
the 64 bit version (using Windows 7). What else do I need to do?
I did have a certain amount of trouble finding the info. The code
samples in the 5.9 docs don't include the required version management.
I've extended my driver structure like so.
ErlDrvEntry dttsp_port_driver_entry = {
NULL, /* F_PTR init, N/A */
dttsp_port_drv_start, /* L_PTR start, called when port is
opened */
dttsp_port_drv_stop, /* F_PTR stop, called when port is closed */
dttsp_port_drv_output, /* F_PTR output, called when erlang has
sent */
NULL, /* F_PTR ready_input, called when input
descriptor ready */
NULL, /* F_PTR ready_output, called when
output descriptor ready */
"zeno-dttsp-win", /* char *driver_name, the argument to
open_port */
NULL, /* F_PTR finish, called when unloaded */
NULL, /* F_PTR control, port_command callback */
NULL, /* F_PTR timeout, reserved */
NULL, /* F_PTR outputv, reserved */
// Extended fields as version management is mandatory from 5.9 onwards
NULL, /* called when we have output from
erlang to the port */
NULL, /* Ready sync */
NULL,
/* called when the port is about to be
closed, and there is data in the
driver queue that needs to be flushed
before 'stop' can be called */
NULL, /* Works mostly like 'control',
a synchronous
call into the driver. */
NULL, /* Called when an event selected by
driver_event() has occurred */
ERL_DRV_EXTENDED_MARKER, /* ERL_DRV_EXTENDED_MARKER */
ERL_DRV_EXTENDED_MAJOR_VERSION, /*
ERL_DRV_EXTENDED_MAJOR_VERSION */
ERL_DRV_EXTENDED_MINOR_VERSION, /*
ERL_DRV_EXTENDED_MINOR_VERSION */
0, /* ERL_DRV_FLAGs */
NULL, /* Reserved -- Used by emulator
internally */
NULL, /* Called when a process monitor fires */
NULL,
/* Called on behalf of driver_select when
it is safe to release 'event'. A typical
unix driver would call close(event) */
/* When adding entries here, dont forget to pad in obsolete/driver.h */
};
Regards
Bob
More information about the erlang-questions
mailing list