5
votes

After installing Delphi XE, my good-old Delphi 7 started to crash more often. Today, I have discovered that one of my BPLs was still loaded by D7 even if I deleted it from "c:\Program Files\Borland\Delphi7\Projects\Bpl". After I have searched the entire disk I have discovered a copy of that BPL in "c:\Users\Public\Documents\RAD Studio\8.0\Bpl".

My question is: why is Delphi 7 looking in "c:\Users\Public\Documents\RAD Studio\8.0\Bpl"? How can I convince it to look only in "c:\Program Files\Borland\Delphi7\Projects\Bpl" ?

1
I think one of those paths in your second paragraph was supposed to mention Delphi XE, no? - Rob Kennedy
IIRC there are project-local settings for this as well as the global ones. Check both. Also, IIRC BPLs are DLLs with some Delphi-magic included, so it's possible that the (global) DLL search path (PATH variable among others) interferes. - 0xC0000022L
Welcome to self-inflicted DLL/BPL hell. DLLs and BPLs don't load from one folder only, they load from wherever they are found, by name, in the path. - Warren P

1 Answers

10
votes

Delphi XE probably augments the PATH environment variable to include the Delphi XE Bpl folder. Delphi 7 doesn't know any better; it calls LoadLibrary just like everything else, and that searches the system path.

Follow the Delphi example and give your packages version-specific suffixes reflecting what version of Delphi they're for. You should be able to configure that in the project options, or else you can just have version-specific project files that already have the version suffixes in their names. That way, even if the Delphi XE version of the package is visible on the path, it won't have the right name, so Delphi 7 won't try to load it.