![]() |
Sharing the same unit between projects
Hi, following question: I want to share the same unit over multiple projects, is there a way to tell him which "uses" he shall use depending on the project? The same way I can tell him which functions to use depending on the operating system?
The problem is, if I include a file which doesn't exist in another project ... Thanks, Etienne |
AW: Sharing the same unit between projects
The problem with missing include files is very annoying.
You have the possibility to add a define in the IDE global project options, defines section for each project. E.g. Global Define: _X_USE_MY_UNITS
Delphi-Quellcode:
Would be much nicer, if could be detected if Include file is declared or not.
{$IF DEFINED( _X_USE_MY_UNITS ) }
{$INCLUDE MyUnit } //<== declares maybe _X_USE_MY_SPECIAL_UNIT_1, ... {$ENDIF } Uses {$IF DEFINED( _X_USE_MY_SPECIAL_UNIT_1 ) } MySpecialUnit1, {$ENDIF } {$IF DEFINED( _X_USE_MY_SPECIAL_UNIT_2 ) } MySpecialUnit2, {$ENDIF } {$IF DEFINED( _X_USE_MY_SPECIAL_UNIT_3 ) } MySpecialUnit3, {$ENDIF } ... {$IF DEFINED( MY_VARIANT_UNIT_1 ) } MyVariantUnit1, {$ELSEIF DEFINED( MY_VARIANT_UNIT_2 ) } MyVariantUnit2, {$ELSEIF DEFINED( MY_VARIANT_UNIT_3 ) } MyVariantUnit3, {$ENDIF } LastUnit ; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:33 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz