As an exercise in using the new FFI in LuART as well as a real use case, I'm trying to use a DLL for serial port handling.
However, I would need some help in finding proper signatures and using pointers for DLL functions like the following:
int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr);
int sp_open(struct sp_port *port, enum sp_mode flags);
Consider that sp_port is an opaque struct type and I have also to manage a pointer to pointer.
local c = require 'c'
local sp_dll = c.Library('libserialport-0.dll')
...
sp_dll.sp_get_port_by_name = 'c(Zp)i' --> ???
sp_dll.sp_open = 'c(pi)i' --> ???
sp_dll.sp_get_port_by_name('COM4', p) --> ???
sp_dll.sp_open(p, 3) --> ???
...
Thanks in advance,