2
votes

I am creating an installer for components that currently do not have one (for example the excellent SynEdit editor library), this has also allowed me to get to understand design and run-time packages better than I did.

I want to ensure the cleanest deployement, so I understand that many units will go into a runtime package, and in time I may deploy using 'build with runtime packages' so that's all good. Often though, the design-time package requires the runtime package and this is where I'm getting into trouble. Typically I create a project group which has the runtime package project (xxx-RXE) followed by the design-time package project (xxx-DXE). Do a build all and everything is fine. I deploy both packages in BPL, DCP and DCU form within a library path of my own and install the design-time package into the IDE using the registry. The library path is then added to the environment settings. When I open Delphi (this is true for D7 as well as XE) I get 'Cannot load package XXXX-DXE, library package xxx-RXE.bpl not found. If I cheat by modifying the design-time package to remove xxx-RXE.dcp from 'requires' and replace this with the units directly, all is fine.

I am trying to avoid poking anything into Delphi folders, so my project structure is like this (only XE is shown, D7 is similar). The packages are set to output units, bpl and dcp to "..\Library\Delphi15", all packages are given a search path of "..\Source" and the design time package an additional search path of "..\Library\Delphi15" (to find the runtime package it requires).

\Root
  \Packages
    xxx.groupproj
    xxx-RXE.dpk
    xxx-DXE.dpk 
  \Library
    \Delphi15
      (output of all dcus, dcp's, bpl's etc. Manually added *.res, *.inc and *.dfm's).     
  \Source
    (The original project source files as used by the packages).

None of the above folders are used by Delphi, I dont do anything with the Delphi IDE until my installer has created the following deployment folder:

c:\Program Files\xxx\Library\Delphi15

(contains all BPL's, DCP's, DCU's etc etc, that is also the path put into the environment library path).

So what I'm not clear about is that if all of the files are in that folder with a path to it, why cant delphi see them?

Thanks for any help.

3

3 Answers

3
votes

Just reading "Cannot load package XXXX-DXE, library package xxx-RXE.bpl not found" triggered bad memories. Usually I got this error when the path containing the DCP (and/or BPL?) is not contained in the Windows environment variable PATH.

When an installed package references another package then the normal "Windows library search behavior" for this referenced package kicks an (on Delphi startup). No Delphi path configurations are active at this time. Thus your installer needs to modify the PATH env variable as well (or copy the file some place already contained).

2
votes

I'm pretty sure that the DCP has to be in Delphi's DCP folder. On my machine with Delphi 2010 and Windows 7, it's in C:\Users\Public\Documents\Rad Studio\7.0\Dcp.

Searching around the registry, this path is found in HKCU\Software\Codegear\BDS\7.0\Library under the value Package DCP Output. Of course you'll have to expand the string, because it's in there as $(BDSCOMMONDIR)\Dcp.

I would also put the runtime BPL in the Delphi default location as well, which again (for me) is C:\Users\Public\Documents\Rad Studio\7.0\Dcp.

2
votes

"library package xxx-RXE.bpl not found" might be misleading. I believe it in fact means LoadPackage failed, for some reason. This might be caused by a dependent package not present in Windows path.