[Lazarus] Word of warning when sharing code between Delphi and FPC
Michael Van Canneyt
michael at freepascal.org
Fri Aug 29 09:55:04 CEST 2008
On Fri, 29 Aug 2008, Mattias Gärtner wrote:
> Zitat von Graeme Geldenhuys <graemeg.lists at gmail.com>:
>
> > Hi Everybody,
> >
> > I have been battling with some code in tiOPF that causes problems when
> > compiled with Delphi 2007, but not with Delphi 7 and FPC.
> > After some head scratching, we found the problem.
> >
> > I use {$IFDEF DEBUG} quite often in my code, to hide things like
> > writeln() statemens. I then have a commented DEBUG define at the top
> > of the unit, so I can enable it per unit when required. That's just
> > how I work... ;-)
> >
> > Anyway in Delphi 2007 there are two compilable states, Release and
> > Debug, with one of those terms automatically added to the options at
> > compile time. Debug mode is the default, which means the DEBUG define
> > is ALWAYS defined - and what caused the problem! writeln() statements
> > fail in a Windows GUI application because StdOut is not available.
> >
> > Just thought I might share this experience with you guys - to minimize
> > future head scratching. ;-)
>
> Will FPC do the same in Delphi mode?
No. It's an IDE feature. Something like 'named compiler options'.
The Delphi compiler by itself doesn't do anything. It just gets the -DDebug
and whatever flags from the IDE.
Michael.
More information about the Lazarus
mailing list