Delphi XE2 needs $ifend with $if; Delphi XE4 is OK with $endif.