AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Sharing the same unit between projects
Thema durchsuchen
Ansicht
Themen-Optionen

Sharing the same unit between projects

Ein Thema von Skullwing · begonnen am 9. Dez 2020 · letzter Beitrag vom 10. Dez 2020
Antwort Antwort
Skullwing

Registriert seit: 29. Okt 2011
12 Beiträge
 
#1

Sharing the same unit between projects

  Alt 9. Dez 2020, 19:19
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
  Mit Zitat antworten Zitat
Rollo62

Registriert seit: 15. Mär 2007
3.908 Beiträge
 
Delphi 12 Athens
 
#2

AW: Sharing the same unit between projects

  Alt 10. Dez 2020, 11:52
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:
{$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
  ;
Would be much nicer, if could be detected if Include file is declared or not.

Geändert von Rollo62 (10. Dez 2020 um 11:57 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz