Port driver communication witout copy of binaries

Valentin Micic valentin@REDACTED
Wed Mar 29 08:33:53 CEST 2006


Is there any reason for not using:

erlang:port_call( Port, Cmd, DATA )

which results in call to linked-in driver's:

int edk_call( ErlDrvData handle, unsigned int cmd, char * buf, int len, char 
**rbuf, int rlen, unsigned int * flags )

Argument DATA specified in erlang's port_call is passed by reference. The 
driver may return data in rbuf. Should there be more memory required that 
specified by rlen, such memory may be allocated, using driver_alloc... no 
need to free rbuf, as it points to automatic variable.

V.

PS
I've been using this approach for integration with some ss7 adapter... to 
cut the story short, it's working just fine. Documentation is indicating 
that this is the fastest way to interact with driver.




More information about the erlang-questions mailing list