delphi64-bitpackagedesign-timebpl

Can I make the `requires` clause in a package conditional?


I'm using Anders Melander's DragDrop package.
It works fine in Win32 mode, but needs adjustment for 64 bit.
I do this by adding {$IFNDEF CPUX64} to comment out the references to the designIDE.

However when I change the package source from

requires
  rtl,
  DesignIDE;

to

requires
  rtl
  {$IFNDEF CPUX64} ,DesignIDE{$ENDIF};

The compiler simply throws away the DesignIDE line in the package source, leaving only:

requires
  rtl;

Which works fine for X64, but breaks as soon as I rebuilt for 32-bit.

Is there a way to have one package including design-time items for win32 with the conflicting items IFDEF'ed out for X64? Or am I forced to create a separate Runtime package for X64?


Solution

  • No, you cannot use conditionals in any project main file. The IDE owns and controls it, and is subject to discarding (and even destroying) any customization you do with conditionals. You will need to create a second package for this, which is normal practice for using DesignIDE anyway. Even if it weren't for supporting 64bit, you're not permitted to deploy DesignIDE with any application. It is for the sole purpose of integrating with the IDE, which for legal reasons, must only reside in a Design-Time package.

    Bear in mind also that the Design-Time package must only be Win32, as the Delphi IDE is only 32bit. Then, the Run-Time package can be any supported platform you wish (i.e. Win64), of course as long as it's supported by any framework it might be using.