Thu Feb 20 16:56:34 CET 2003
Ulf Wiger wrote:
>Using named ports, port_control(), and the ability to
>build and return an Erlang term directly in the driver
>routine, you can basically create your own BIFs today.
>The overhead is minimal compared to normal BIFs.
Documentation about this, of course, is nonexistent :)
I'm glad that Vlad started this thread, because drivers have always bothered
me. Under Windows, linked-in drivers are the only real option, because of
poor pipe performance. Writing a linked-in driver is fairly easy, but it
seems a black art. What the heck do port_control() and other undocumented
hooks do? What are some of the callbacks in the driver entry struct for?
You need to be very careful in driver code, but the current system has
enough questions and housekeeping that I find it hard to be confident that I
have done things correctly.
For lack of a revolutionary idea, I think that the erl driver struct could
be done away with completely. If you want start up and shut down behavior,
you can do it outside the scope of Erlang (at least under Windows). Then
all you need is one exported function that takes a pointer and a length.
P.S. Related Wikie page:
More information about the erlang-questions