Question

This is something new for me, and the question is probably more about the Delphi IDE than the code.

I want to develop a DLL and two applications which will use it.

I made a very basic DLL and a quick dummy app to test it. So far, so good. BUT, all the source was in a single directory.

I feel that I probably ought to have a group project containing three projects (DLL + 2 apps).

But how do I get the apps to use my DLL during the development phase?

I don't want to copy it into the windows system directory while I am in the process of develop it, but when I add it's directory to the app's search path it is not found.

How do I configure my app projects to use the still in development DLL?


[Update] Wow, my quickest ever down-vote. One minute! And, as usual, not even a comment to say how I offended, other than asking for help.

I have googled, and I have read the help. But I can't see how to do it, so am asking for help.

Was it helpful?

Solution

The preferred way to enable an application to see a DLL is for the DLL to be located in the same directory as the host executable.

I typically do that by having a project group with executable and DLL. Make sure that all the projects output their executables to the same directory. If the .dpr and .dproj files are all in the same directory, and the default output directory of .\$(Platform)\$(Config) is used, then all will be well. All executable files land in the same directory, and the loader will find them.

Doing it this way has a number of benefits:

  1. No need for any post-build actions to copy files around.
  2. Debugging works well. You can step into and out of the DLLs, and step through source.
  3. You can rebuild all the executables in one go using the Project | Compile All Projects menu item.

An aside. You said:

I don't want to copy it into the Windows system directory while I am in the process of develop it.

Well, please don't ever copy it into the system directory. That directory is private, it is owned by the system. You should not place files there.

When you come to deploy your application onto other machines, you should prefer the option of placing executable and DLLs in the same directory. That's the simplest deployment technique, and the most secure and maintainable. That's the method that avoids DLL hell.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top