1

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?

Johan
  • 74,508
  • 24
  • 191
  • 319
  • 3
    The rules are clear. Design time packages separated from runtime packages. – David Heffernan Sep 13 '15 at 16:24
  • 1
    Old trick - edit your package outside IDE, and when afterwards IDE asks to save a package always say 'No'. – kludg Sep 13 '15 at 16:35
  • 2
    If Anders' code requires the `DesignIDE` package in a **runtime** package (and I would be very surprised if it does), then his code is not properly separated. `DesignIDE` can only be used in a "**designtime only**" package. It cannot be used in a "**runtime only**" package, or in a "**designtime and runtime**" mixed package. Designtime code is not allowed in runtime packages. – Remy Lebeau Sep 14 '15 at 03:09
  • Anders only provides a design time package. As per the readme: "This folder contains the design-time package source files. To install a package, open it in Delphi, select build and then install." – Gerry Coll Sep 14 '15 at 04:31
  • 1
    @GerryColl That doesn't mean it's right. Any package which needs to use any design-time IDE integration (via `DesignIDE`) *should* be split into two packages. Attempting to keep them in one is only asking for a nightmare. This is for legal reasons why Design-time code is not permitted to be deployed with the end-product. Further, I've never come across a single package which supported both design-time and run-time. – Jerry Dodge Sep 14 '15 at 05:47
  • Using runtime packages is optional - I never use them. Design time is required for using the RAD features. It explicitly refers to the packages as design time packages. I doubt it's difficult to create your own. – Gerry Coll Sep 14 '15 at 07:46
  • @GerryColl: Design time packages are never 64 bit. If this can be a 64 bit package, it is by definition a runtime package, and the design time code should have been separated from the runtime. Splitting such a package into two is not really rocket science. – Rudy Velthuis Sep 14 '15 at 08:28

1 Answers1

4

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.

Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
  • That's a real bummer. – Johan Sep 13 '15 at 16:07
  • @JerryDodge: Actually *any project main file* is a bit too general. E.g. program IfDefs; uses SysUtils {$define Test} {$ifndef Test} Blam! {$endif}; begin end. "any *package* ..." may be ... – MartynA Sep 13 '15 at 19:50
  • @MartynA I've had problems with EXE main files which forced me to move the app initialization to a separate unit, usually named `AppInit.pas` and from the project main file I call a procedure there called usually `RunApp`. – Jerry Dodge Sep 13 '15 at 20:54