[erlang-questions] {error, no_driver_init}
Bob Cowdery
Bob.Cowdery@REDACTED
Mon Oct 9 16:57:14 CEST 2006
Bob Cowdery a écrit :
> > Hi
> >
> > I am trying to get a port driver to work on Windows. This is just
the example in the tutorial . I can get it going on Linux but I get the
no_driver_init error on Windows. I have built this with Visual Studio
Express, so it's VC8. I am wondering if Erlang is built with VC6 and
therefore the library is incompatible. Could this be the case? Other
than that maybe its incorrect flag settings. I have set it to build C
but don't know what else might be important.
> >
> > Any help appreciated.
> >
> > Thanks
> > Bob
Hi,
There is long time I didn't play with drivers but I remember this kind
of trouble.
Check that your driver is exporting the driver_init() function. (You can
easily check this with DependencyWalker [1] ).
I also remember that the sample didn't work with me I had to do as follow:
ErlDrvEntry messenger_driver_entry = {
NULL, /* F_PTR init, N/A */
messenger_driver_start,
messenger_driver_stop,
messenger_driver_output,
NULL,
NULL,
"messenger_driver",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
extern "C"
{
DRIVER_INIT (messenger_driver)
{
return &messenger_driver_entry;
}
}
Regards,
Nicolas
------------------
Nicolas
Thanks for the hint. I did get it working but had to compile it as C++ and then extern "C" the exported method. I checked and it was exported fine when compiled as C but Erlang just couldn't see it. I don't like things I can't explain so if anyone knows why this is I would be pleased to hear.
Thanks
Bob
[1] DependencyWalker : http://www.dependencywalker.com/
More information about the erlang-questions
mailing list