[erlang-questions] R15B changes erl_driver API
Sergei Golovan
sgolovan@REDACTED
Thu Dec 15 16:44:41 CET 2011
Hi!
Appears that erl_driver API has been changed in R15B. The following
change in erts/emulator/beam/erl_bif_ddll.c (R15B with respect to
R14B04)
-----------------------------------------------------------------------------------------
}
switch (dp->extended_marker) {
- case 0:
- /*
- * This may be an old driver that has been recompiled. If so,
- * at least the fields that existed in extended driver version
- * 1.0 should be zero. If not, a it is a bad driver. We cannot
- * be completely certain that this is a valid driver but this is
- * the best we can do with old drivers...
- */
- if (dp->major_version != 0
- || dp->minor_version != 0
- || dp->driver_flags != 0
- || dp->handle2 != NULL
- || dp->process_exit != NULL) {
- /* Old driver; needs to be recompiled... */
- return ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
- }
- break;
case ERL_DRV_EXTENDED_MARKER:
if (ERL_DRV_EXTENDED_MAJOR_VERSION != dp->major_version
|| ERL_DRV_EXTENDED_MINOR_VERSION < dp->minor_version) {
-----------------------------------------------------------------------------------------
makes R15B return error "incorrect driver version" for so-called old
drivers (which don't initialize fields extended_marker, major_version
and minor_version in their ErlDrvEntry structure, or initialize them
as zeros).
As a consequence
1) documentation became incorrect (at least
http://www.erlang.org/doc/man/driver_entry.html where extended_marker
is still allowed to be 0);
2) example from http://www.erlang.org/doc/tutorial/c_portdriver.html
doesn't work anymore;
3) many existing applications break (YAWS and ejabberd definitely, I
suspect many others too, because example in tutorial don't use
extended_marker).
So, will this change be permanent (the documentation and all
applications are to be fixed), or this change will be considered too
disruptive and old drivers will be allowed back in R15B01?
(By the way, the error message is a bit misleading, especially after
the driver was recompiled using R15B.)
Cheers!
--
Sergei Golovan
More information about the erlang-questions
mailing list