We use a DLL file to receive data from the serial port, this works.
We:
- open port
- handle the data
- close the port again
- return calculated values
problem: We need to seperate the open/close and handle parts to reach maximum speed. So we dont have to open and close the serial port each time we receive new data.
We open the serial port with hCom:
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
But the question is, how can we open the port in one DLL block, so we can use this in the read DLL block function? So we have to return the hCom HANDLE value or something.