[Lazarus] Strange dependency of units

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sun Apr 1 17:51:52 CEST 2012


Jürgen Hestermann schrieb:
> Mattias Gaertner schrieb:
>  >> That's exactly what I did. I used Larazus to create a console
>  >> application. I then added my general purpose unit to the uses clause.
>  >> Then compile failed with an error message that had nothing to do 
> with my
>  >> program or unit.
>  >
>  > A console application is for simple stdin/stdout programs that runs in
>  > the DOS box, the OS X terminal, the Linux shell, etc.
> 
> Exactly. That's what I wanted to create. I only included my general 
> purpose unit which I also use for LCL programs.

The design of your "general purpose" unit obviously is flawed. Console 
and GUI applications differ in many subtle ways, and I suggest that you 
use {$IFnDEF CONSOLE} to exclude everything that is available and usable 
only in a GUI application. This general purpose solution already exists, 
you simply did not yet find out how to use it :-)

There exist more hidden pitfalls, e.g. that you have to use SysUtils in 
order to make SEH work - a Delphi heritage.

DoDi





More information about the Lazarus mailing list