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:
- No need for any post-build actions to copy files around.
- Debugging works well. You can step into and out of the DLLs, and step through source.
- 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.