Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add multiple library versions to Delphi Options' library path

Status
Not open for further replies.

tvg212

Programmer
Oct 9, 2006
9
0
0
US
How can I add multiple versions of a library to the Delphi 2006 Tools->Options->Library path? I want to develop the next version of our software in BDS 2006 and still be able to compile our current version on the same PC. The two projects will run from different folders. I have a library of functions that I use with the current version and will use it in the new version with some changes. This is the library file that I am having trouble knowing how to add it to the library path and having the two versions access the right one.

Example: My two versions are in folders C:\V5 and C:\V6. The library functions in v5 are in a folder called dlib (C:\V5\dlib). I am going to copy the dlib folder to V6 and rename it to dlib_V6 (C:\V6\dlib_V6). I need to add these two paths to the BDS 2006 library path but how do I make sure that at run time V6 will search from the right one since my V5 library path will come first and most of the function names are the same.
Thanks.
 
You just add the respective lib directories to the individual project's lib dir path property; ie for a project that uses a V5 lib, add the lib path "c:\v5". Library directories are local to each project. You do not have to have both versions included into the project at the same time.
 
Thanks Prattaratt for your reply. I have a following question: with my current version i set up my library paths once and don't have to ever check it again. The way I am understanding your answer is that with two versions running on the same Delphi I should check my library paths every time I load a project and change the library paths accordingly. (It makes sense, the only problem I see is I forgetting to check it out at least before I get used to the habit). Please clarify if I got you right.
Thanks.
 
Yes, you would have to check the directory each time and change it if it is not correct.

Question: Is this a reason you cannot just rename the Library or Unit itself? A better solution might be to rename the newer lib and keep in the same directory, that way you don't have to worry about path search order. As long as you don't link in both files into the same project, you don't have to worry about duplicate identifiers. If these are DCU's you don't even have to be concerned about that, you will just have to specify which Unit you are accessing like so:
Code:
  Dlib.SomeFunct;  // calling old unit's somefunct
  Dlib_6.SomeFunct; // calling Dlib_6 somefunct

Just make sure you change the unit name in the interface as well.
 
Thanks once again Prattaratt. I really wanted to keep the two versions in separate folders including the library directories. In my current version I just call the library functions without the dir, ie, just call SomeFunct in my code and I wanted to be able to do the same in my new version. However, you have given me great insight and I will weigh the two options and see which one works better for me.
Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top