Getting BPL Versions at program startup
Is it possible to check what version of BPL (ie Rtl70.BPL, Indy70.bpl etc) are installed on a clients computer when the program starts?
I have had some programs crash because the BPL on there computer is different to the ones on the build machine. If i have to add each BPL used into the installer on each update, i think it will defeat one of the points on using them.
Delphi 7, if it makes a difference
Just a follow up on the issue i had. The rtl70.bpl file was only slightly different between the build computer and the clients.
Clients Computer: 188.8.131.523 760 KB (778,240 bytes) Tuesday, 20 August 2002, 4:40:26 PM Build computer: 184.108.40.2063 760 KB (778,240 bytes) Friday, 9 August 2002, 11:30:00 PM
The updater i was using ignored them as being the same (no change in build number), but when i manually deleted and copied the files every thing seemed to work.
Unfortunately, no. If the crash is due to missing imports from the .bpl files required by your application, there is no way (short of rewriting the Delphi RTL and linker themselves) to check for those packages from within the crashing executable itself. PatrickvL's solution is probably the best for your situation.
Neftalí's solution might be an option - of course, at the cost of packaging the RTL, duplicating a lot of files, and losing one of the points of having packages in the first place. However, if you're using private DLLs (i.e., if you copy the DLLs in your private binaries directory) then you should also create an empty file with the same name as your executable but appending the extension .local to it, i.e. for notepad.exe you'd create a notepad.exe.local. See Raymond Chen's article on DLL redirection for more details.
If your program crashes, it's probably because it can't load the library it's dynamically linked with. (As you where saying, this happens when the system can't find a copy of the needed libaries anywhere in the search path).
The problem is, that this happens at startup of an application, which the Windows OS does via an API called MapAndLoad (also read this). This API is called before your application is even started, so I see no way to intercept this.
One suggestion I could give, would be to use a launcher (which has to be statically linked, to prevent problems for when there are /no/ libraries at all). This launcher could inspect your actual application, see what imports it needs, checks your environment and display a nice failure/troubleshooting suggestion dialog to the user.