[fpc-devel]Detecting current apptype?

Jonas Maebe jonas at zeus.rug.ac.be
Fri Dec 22 13:37:56 CET 2000


On Fri, 22 Dec 2000, Lawrence wrote:

> 	I'm currently writing some general-purpose multi-platform type units, and
> all works well except I notice that
> 	some of it doesn't work with {$apptype gui} defined. This is to be
> expected, of course, since some of it is
> 	text-mode related. I would like to use {$ifdef} statements to exclude
> certain functionality when GUI apps
> 	are being created, but I don't know how. Is there an easy way, like {$ifdef
> go32v2} sort of thing??

You can't know at compiletime of your unit whether the program that will
use it will use {$apptype gui} or not. You can check it at runtime thoughm
there's a global boolean variable in the system unit that's set to true. I
don't know whether it's public not the name, but if you compile a program
using the -a option, you should be able to see the name in the generated
assember code (the first instruciton of the main program sets the apptype
variable)


Jonas





More information about the fpc-devel mailing list