Solved

Where delphi find BPL files?

Posted on 2006-07-14
10
808 Views
Last Modified: 2010-04-05
Hi,


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.

Tanks.

Antenor
0
Comment
Question by:antenor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 28

Expert Comment

by:2266180
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
0
 

Author Comment

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

For dynamic load, it is OK!
0
 
LVL 28

Expert Comment

by:2266180
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:2266180
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 ;)
0
 
LVL 7

Accepted Solution

by:
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
0
 

Author Comment

by:antenor
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?


0
 
LVL 7

Expert Comment

by:kfoster11
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).
0
 

Author Comment

by:antenor
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.

0
 
LVL 28

Assisted Solution

by:2266180
2266180 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
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 17112003
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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