[Lazarus] Different packages for different usage

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jun 19 13:17:04 CEST 2015

On Fri, 19 Jun 2015 03:53:10 -0700
aradeonas <aradeonas at operamail.com> wrote:

> Beautiful! Thank you Graeme and Mattias and also Juha.
> So summery is when I have 2 package named clientpkg and serverpkg with
> shared unit but fist one with graphical dependencies so when I make an
> server app I should declare for example -ThisIsServer and for client
> nothing and in code use compiler condition so when ThisIsServer declared
> I exclude graphical code.

Yes, pass -dThisIsServer to the compiler.

> Correct and this is the best way?

Depends. Some people don't like scattering their code with IFDEFs. Sven
gave you an alternative with abstract classes.

> Also I want to ask how can I find out my app is running in non graphical
> OS?with compiler condition?

The compiler run *before* the application is running. So, no there is
no compiler condition.
Please define what you mean with "is running in non graphical OS".


More information about the Lazarus mailing list