Where delphi find BPL files?

Posted on 2006-07-14
Last Modified: 2010-04-05

Where deplhi find BPL files (with runtime packages) ? Only looking "path" (environment variable) ?? Do not exists another way ?

I want create one subfolder called "Lib" for store all BPL files. This folder will be distribuited with my .EXE file.


Question by:antenor
  • 4
  • 3
  • 2
  • +1
LVL 28

Expert Comment

ID: 17107882
that is partially correct. delphi will search for a bpl following the windows standard "algorithm" that can be found in msdn and another few places.
so what you will have to do is add the extractfilepath(application.exename)+'Lib' to the system path

Author Comment

ID: 17107918
ok, but i use "static" runtime package...

For dynamic load, it is OK!
LVL 28

Expert Comment

ID: 17108016
for dynamic load you specify teh path so there is no need to bother with this issue. the issue is indeed at static linking and that is why the lib dir must be in the path as actually it's not delphi nor your app that is searching for the bpl's but the system
LVL 28

Expert Comment

ID: 17108020
the reason I said: extractfilepath(application.exename)+'Lib'  is to state that you need to add full path not relativ path top the system path ;)

Accepted Solution

kfoster11 earned 350 total points
ID: 17108110
For static the os will load the packages before your application starts running so a few options would be to;
1) create a batch file that adds to the path and then launches the application
2) create a small front end application that sets up the environment and then executes the main application as a child process
3) add the path to the users environment settings so that windows automatically creates the environment for you.
4) place the bpls in the same folder as the exe.
5) place the bpls in the windows\system32 folder (this is where they belong according to Microsoft :)  

good luck
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Author Comment

ID: 17108229
So, it wants to say that, in the case of static packages, does not have another alternative that:

-  set the PATH (environment variable) to my "lib" folder, or;
-  place BPLs files in the Windows\system, or
-  place BPLs files in the same folder as the exe.

is this ok?


Expert Comment

ID: 17108529
basically, static dlls (or bpls) are loaded prior to any code in the application being processed.  So the OS has to be able to find the BPL's at the time the application is loaded into memory, so you have to have the BPL's in the path prior to executing the application.

when searching for a file, windows first looks in the applications folder then the windows folder then the system folders (system,system32) then it goes through the path,

I would personally add the extractfilepath(application.exename)+'Lib' to the all users environment in my installation program(I couldn't locate the code to do this, if you want it I will look through my archives).  but basically the easiest thing to do would be to place the BPL's into the applications folder (this would be the first place the OS looks).

Author Comment

ID: 17108701
The problem is that I have my application in many customers ( and many computers ).

If it was possible to set this -  extractfilepath(application.exename)+'Lib' to path of the user environment) - inside of application (on load), would be solved the problem.

LVL 28

Assisted Solution

ciuly earned 150 total points
ID: 17109065
unfortunatly that is not possible. and I can't think of any workaround for the application except dynamically loading them
LVL 12

Expert Comment

ID: 17112003

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now