delphi 7. How to check whether the unit file exists and add it with (directives?) to compile with the project
I have a unit which is the part of several modules(dll, applications).
In some of them I need to use in that module their classes.
Is it possible to use compiler directives (o开发者_如何转开发r other methods) to include the unit to the file in case it is included in the project?
Thanks!
If I understood you correctly, the answer is yes. You can use a conditional define in the uses clause:
uses
{$IFDEF USE_MYSTUFF}
MyUnit,
{$ENDIF}
Classes, Windows;
and then define (or not) a conditional define USE_MYSTUFF
in the project options.
See also $IFDEF
, $DEFINE
and $INCLUDE
directives and Conditional Compilation.
精彩评论