Delphi – Getting BPL Versions at program startup

bpldelphidelphi-7

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: 7.0.4.453 760 KB (778,240 bytes) Tuesday, 20 August 2002, 4:40:26 PM
Build computer: 7.0.4.453 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.

Best Answer

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.