kgiddings
(kgiddings)
February 24, 2012, 10:28am
1
Copied from emb.public.prism.language
I have the following block in code that has to compile in both Prism
and Delphi:
{$IFDEF OXYGENE}
uses
{$IFDEF SYMBOL1} unita.unit1, {$ENDIF}
System.Collections.Generic,
System.IO ,
System.Text;
{$ELSE}
uses
{$IF COMPILERVERSION < 23.0}
graphics,
{$ELSE}
UITypes,
{$IFEND}
{$IFDEF SYMBOL1} unita, {$ENDIF}
Windows, SysUtils, Classes, DateUtils,
unitx,
unity,
unitz;
{$ENDIF}
The second $ELSE is giving me an error in the oxygene compiler when in
theory the whole block should be being ignored as it is not relevant
to prism. Is this a bug? if not, how can I have defined blocks
that are purely to be parsed by delphi and ignored by prism?
Regards
Keith
viktoriad
(viktoriad)
February 24, 2012, 3:18pm
2
Hello Keith,
Thank you for the report. The bug is reproduced and logged for further review (#53963 ). I’ll let you know when we have any news on that issue.
Best regards.
ck
(Carlo Kok)
February 24, 2012, 4:25pm
3
It’s a limitation. We don’t have a “$IF” compiler/$IFEND, so the compiler sees your $ELSE as belonging to the IFDEF.
a fix for this is:
{$IF COMPILERVERSION < 23.0}
graphics,
{$IFEND}{$IF COMPILERVERSION >= 23.0}
UITypes,
{$IFEND}
kgiddings
(kgiddings)
February 26, 2012, 3:55pm
4
Thanks Carlo, that sorted it.
Regards
Keith
Patrick
(Patrick Lanz)
February 26, 2012, 4:55pm
5
{$IFEND}
Carlo,
it’s a new compiler directive, or a typo?
Patrick
ck
(Carlo Kok)
February 27, 2012, 9:22am
6
@Patrick : New in delphi since v6 or v7 or so. Not supported by Oxygene.