{$IFDEF FPC}
interfaces, //Needed for LazSerial to work in a Console program
LazSerial, //The serial component
{$ELSE} //Delphi
When I now build the project the linker does not trigger any
complaints about missing Menu related identifiers and the build
succeeds!
The Interfaces unit links in the GUI widgetset of the LCL which is not really what you want for a command line application. Do as Jurassic Pork (and Michael on the mailing list) suggested and use the serial component of Synaser directly (TLazSerial is "simply" a GUI wrapper for that).
Back again...
The trick with adding interfaces to the uses clause just before LazSerial "
seemed" to work.
But that was because I was running my console app inside a terminal window in Raspbian Buster on an RPi4.
Today I tried to run it inside a PuTTY SSH shell window connected to that same RPi4.
The result was that I got this error:
$ ./SSRemoteServerLx
(SSRemoteServerLx:5753): Gtk-WARNING **: 14:39:10.439: cannot open display:
Apparently there are GUI dependencies that are not met in a "real" console and stops the application from even starting up.
Since the program must in the end run as a Systemd service on an RPi4 server with
noone logged on it must not behave this way...
So now I am coming back to this problem once more,
how can I remove the GUI dependencies from LazSerial?
Or how can I use SynaSer directly, as has been suggested, when it is blocking and the code (rather big) I am porting is using an event driven concept for receiving data?
As far as I can see the Synaser serial component uses blocking reads rather than events to signal arrival of data to read...
Do you know of any Synaser adaptation adding an OnRxData() event such that it can fire as the event on LazSerial does but does not bind in GUI dependencies?