Link to home
Avatar of starhu
starhu

asked on

Condition define problem in multi programming environment

Hello,

We have a big application with a lot of conditional defines (which tell the compiled units).
The real situation is much more complicated than the example below but it will help you understand the problem:

- Let's say that we have 3 main units: main1, main2, main3.

- In each of these units uses section are common units and conditional units, e.g.

uses
   MyData, MyProc

 {$IFDEF SERVICE_MODULE}
,ServiceMain
,ServiceMaintanance
{$ENDIF}

 {$IFDEF BORROW_MODULE}
,Borrow1
,Borrow2, Borrow3
{$ENDIF}

Open in new window


The problem is this: two programmers work on the same project but one with SERVICE_MODULE, the other with BORROW_MODULE;

If the first builds the program, then when the second programmer runs the program from Delphi, there is a message that ServiceMain doesn't exist in the project.
If he builds the project, everything would be fine for him, but then the first programmer would get the message: Borrow1 doesn't exist in the project.... and so on..

What is the easiest way so as the two programmers can work on the same project without bothering each other?
(very often both modify the common units too, of course after conciliation)

Thank you
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Best approach is to use SVN or similar source version control.
Very popular is: https://subversion.apache.org/

SVN can merge project into one. If you want to use definitions, then each programmer must have own dproj/project definition file where is under DCC_Define (or in Project/Option/Conditionals) set one one case SERVICE_MODULE and BORROW_MODULE in another. This can be done in include .inc file too like this:

unit main1;

interface

{$I CompileSett.inc}
...

Open in new window


where CompileSett.inc is a file in project folder for one programmer:
{$DEFINE SERVICE_MODULE}

Open in new window


... and for another...

{$DEFINE BORROW_MODULE}

Open in new window


... and naturally, all usage of units ServiceMain, Borrow1, .. must be inside of {$IFDEF}..{$ENDIF}
Avatar of starhu
starhu

ASKER

We use Windows in the office. Can it be used with Windows, too?

Thank you
Avatar of starhu

ASKER

I found this "how to" link: http://www.wikihow.com/Install-Subversion-on-Windows-7

Is this the subversion you wrote about?
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Get rid of the conditional defines. They are the cause of your problems and not necessary.