Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2000-12

Detecting current apptype?

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lawrence

Hello,

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??

TIA.

Lawrence Alexander Curwood.
Paradice Software, NZ. http://connect.to/paradice

Reply by email

Peter Vreman
Show quoted text 10 lines
Hello, 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??
{$ifdef go32v2} and {$ifdef win32} and {$ifdef linux} etc. exists, see the documentation
for more info.

Reply by email

Jonas Maebe
to Lawrence: I'm currently writing some general-purpose multi-platform type units, and all works well…
Lawrence wrote 8 lines
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

Reply by email