views:

174

answers:

3

We're slowly converting a big and complicated collection of Delphi 6 projects to Delphi 2007.

In Delphi I can use compiler directives in dpr, dpk and pas files to make different code visible to different versions. For example:

requires
  rtl,
  vcl,
  vclx,
  {$IFDEF VER180} //Delphi 2007 and later
  IndyCore,
  IndySystem,
  IndyProtocols;
  {$ELSE} //earlier than Delphi 2007
  IndyCore60,
  IndySystem60,
  IndyProtocols60;
  {$ENDIF}

However, I don't know how to do the same in a dof file. The requires clause above is for a package that is used by a program. I want that program to have a different packages setting for different versions of Delphi. So I want to put something like the following in the dof file:

{$IFDEF VER180}
Packages=vcl;rtl;vclx;IndySystem;IndyCore;IndyProtocols;MyPackage;
{$ELSE}
Packages=vcl;rtl;vclx;IndySystem60;IndyCore60;IndyProtocols60;MyPackage;
{$ENDIF}

I'm very new to Delphi 2007 so hopefully I'm missing something really obvious!

Any suggestions received gratefully.

A: 

Instead of trying to have one project I would split it up in two projects, a Delphi 6 and a Delphi 2007 project. All you should have to do is add the necessary units to each project and keep the dpr's in sync.

Lieven
+2  A: 

In Delphi 2007, you don't need the dof files anymore. All information is in the dproj file.

With version 2009 you can create different build configurations.

But as I understand it correctly, you have a code base in Delphi 6 and want to convert it slowly to 2007?

First why not directly to 2010? You get unicode support (this can be a reason not to go to 2009/2010). The IDE of 2010 is great to work with. Stable and some new features. If unicode is not your thing, but you want 64 bit in the end, you need to go through the unicode phase in the end so why not right now.

Next, you can share the unit files. But create different projects for each Delphi version. The project files are too version specific to share between versions.

Gamecat
bdsproj was <= 2006. D2007 uses dproj.
Ulrich Gerhardt
You are right. Corrected it.
Gamecat
But the dproj format of 2007 differs from 2009 ;-). The conditional posibilities using 2009 build configurations are great although a bit clumsy included in the IDE.
Gamecat
A: 

D2007 doesn't use *.dof's. Instead the options are stored in YourProject.dproj. So there should be no conflict.

Ulrich Gerhardt