Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Conditionally including units in a project

0 views
Skip to first unread message

Frank Peelo

unread,
Jan 18, 2001, 11:25:35 AM1/18/01
to
Anyone know how I can conditionally include a unit in a project?

I have a unit for writing strings to a text file so I have a record of
how it went, and I only want to include the unit if I defined a value
at compile time. So I had

{$ifdef DEBUGLOG}
debuglog,
{$endif}

in the uses clause of the .DPR. But then Delphi wiped out the {$ifdef
DEBUGLOG} and {$endif}. So I got rid of it from there, just left it in
the uses clause of the unit which I was debugging. Sometimes Delphi
just puts it back in.

I dunno, clever IDEs may be good, but when it starts messing with the
code I put in, without asking me, I get worried that it might be _too_
clever.

FP


Bruce Roberts

unread,
Jan 18, 2001, 1:14:16 PM1/18/01
to

"Frank Peelo" <fpe...@portablesolutions.com> wrote in message
news:9475m8$83k$1...@kermit.esat.net...

> Anyone know how I can conditionally include a unit in a project?

Unless a unit has an Initialization or Finalization section the linker is
smart enough to exclude it (or parts of it) if it is not required by the
app. If you do have such sections, try enclosing them in {$IfDef}{EndIf}.


0 new messages