[erlang-questions] Passing parameters to a port driver

Sebastian Bello <>
Fri Feb 1 13:50:52 CET 2008


Per,
sorry but I didn't mention I was thinking about a linked-in driver; I 
read about extending the environment, but was wondering if it can be 
done by passing parameters; I guess the "char *buff" parameter on the C 
side must have that purpose.
    Sebastian-

Per Hedeland escribió:
> Sebastian Bello <> wrote:
>   
>> is there a way to pass parameters (maybe in the form of an Erlang term) 
>> to a port driver while creating it (open_port)? My understanding is that 
>> open_port launches the function
>>    static ErlDrvData driver_start(ErlDrvPort port, char *buff)
>>
>> on the port; what does "char *buff" contain?
>>     
>
> It's the complete Command string from open_port({spawn, Command}, ...) -
> i.e. you can give that as "my_drv param1 param2" and the my_drv driver
> will have its start() function invoked with that exact string as its
> second argument (in C form of course:-). If you look at the
> driver_entry(3) man page, the argument is called 'command', which
> perhaps makes this a bit more obvious.
>
> --Per Hedeland
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
> __________ NOD32 2833 (20080129) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080201/5ca8aa14/attachment.html>


More information about the erlang-questions mailing list