On Wed, 22 Jul 2020, Bo Berglund via lazarus wrote:

On Wed, 22 Jul 2020 12:34:34 +0200 (CEST), Michael Van Canneyt via
lazarus <lazarus@lists.lazarus-ide.org> wrote:

Then while chasing a strange error concerning wsmenus I changed from
what it was in the beginning to nogui.

It means you have somewhere a reference to a LCL/VCL unit.

Probably your use of TTimer caused this.


No, it was caused by package LazSerial...
It brings in a number of units I would not use in any console app like
this:

SysUtils, lazsynaser,  LResources, Forms, Controls, Graphics, Dialogs;

The "solution" (after googling a lot) was to add "interfaces" just
before lazserial in the uses clause of the unit that handles the
serial comm stuff:

 {$IFDEF FPC}
   interfaces, //Needed for LazSerial to work in a Console program
   LazSerial,
 {$ELSE} //Delphi

Then these linker only errors went away (compile phase worked just
fine before I did this).

The lazserial seems to be a wrapper around lazsynaser, which I assume is from 
synapse.

You should be OK just using directly lazsynaser.

It has no GUI dependencies. The drawback is probably that you must create
the component in code instead of dropping it on a datamodule.

I would suggest to the maintainers of lazserial to

a) Really clean up the uses clause.
   There is no need for  LResources, Forms, Controls, Graphics, Dialogs in the 
uses clause.

b) *always* put the registration of a component in a separate unit,
   never in the unit itself. It creates unwanted dependencies.


Michael.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to