DLL location question. 
Author Message
 DLL location question.

I have VS V6 and V7 on my Win2k system. I have a program that uses
dll's I have written. The exe can find the dll's if they are in the
same directory as the exe. If I put the dll's in ..\vc7\bin, the exe
can't find them because the system path only has ..\vc98\bin (from VS
V6) in it (aside from other non-VS directories). I'm almost sure I
installed V6 after V7 on this system. Did V7 install correctly? I'm
reluctant to reinstall either version because I have modified the IDE
quite a bit. Also, I'd rather not put the dll's in windows\system
because I have V6 and V7 dlls with the same name. If I have to, I
could give them different names. The target systems will not have this
problem because they will only be running one version of the dll's.


Sun, 18 Sep 2005 22:01:19 GMT  
 DLL location question.

--------------------

Quote:

> I have VS V6 and V7 on my Win2k system. I have a program that uses
> dll's I have written. The exe can find the dll's if they are in the
> same directory as the exe. If I put the dll's in ..\vc7\bin, the exe
> can't find them because the system path only has ..\vc98\bin (from VS
> V6) in it (aside from other non-VS directories). I'm almost sure I
> installed V6 after V7 on this system. Did V7 install correctly? I'm
> reluctant to reinstall either version because I have modified the IDE
> quite a bit. Also, I'd rather not put the dll's in windows\system
> because I have V6 and V7 dlls with the same name. If I have to, I
> could give them different names. The target systems will not have this
> problem because they will only be running one version of the dll's.

Hi,

Finding DLLs is the job of the system calls "LoadLibrary" and
"LoadLibraryEx". You can look up the
functions' documentation at http://msdn.microsoft.com. In short, this is
how the DLLs are found:

----

.. the function searches for the file in the following sequence:

The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path
of this directory.
The 16-bit system directory. There is no function that obtains the path of
this directory, but it is searched.

Windows Me/98/95:  This directory does not exist.

The Windows directory. Use the GetWindowsDirectory function to get the path
of this directory.
The directories that are listed in the PATH environment variable.

----

If the DLL is not in one of the above directories, it won't be found. Note
that when multiple DLLs with the same name are present, the above ordering
rules determine which one gets loaded.

In general, it's safest to put the DLL in the same directory as the EXE.

--
Tanveer Gani, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.



Sat, 24 Sep 2005 01:55:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Assembly.Location returning shadowed location

2. dll locations

3. Filename, Location from within DLL

4. Breakpoint on location in unloaded DLL?

5. Location of const data in an exe or dll

6. DLL location?

7. Main Program/DLLs share same registry location.

8. DLL location

9. How to know DLL location?

10. Configuration file location question

11. File location question

12. Newbie question --- ATL dll using Wininet.dll

 

 
Powered by phpBB® Forum Software