If I want to share a DLL between Windows programs, I can put them into
C:\WINDOWS\System (or C:\WINDOWS\System32 on NT). If I start an application
which is linked against a DLL in the system directory, it will find the
DLL automatically. This is similar to /lib and /usr/lib on UNIX.
What is the reason of having a Common Files directory (C:\Program
Files\Common Files)?
How can I tell my app to look in this Common Files directory to find the
DLL's it requires?
Cheers
Henning
--
J. Henning Schwentner
Lanthan Software KG
Now to Common Files. I checked my Common Files directory and found
there many DLLs under app specific folders. Then I picked one
mysteriously named DLL and searched it in registry. It was in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Share
dDLLs. There were a full path of the file a DWORD value of 1. This
means that only one application is using this file. You could add
yours DLLs to this list and increment value when it already exists
and decrement value when uninstalling. When count drops to zero,
you should delete the setting and the file. And does OS find DLLs
from Common Files, if DLL is not in path? Maybe it can. There are
docs on this in the net, I think.
--
JMu
"J. Henning Schwentner" <hschw...@yahoo.com> wrote in message
news:9tj94b$2vnhe$1...@news.hansenet.net...
This is not magic on either OS; both folders are
in the system path.
>What is the reason of having a Common Files directory (C:\Program
>Files\Common Files)?
Placing application DLLs in the Windows System
folder opens the system up to errors. In order to keep
the system stable, expect future versions of Windows
to make the system folder read-only by default
(Windows 2000 offers this as an administrator option;
of course, it can be done manually in prior NT versions)
>How can I tell my app to look in this Common Files directory to find the
>DLL's it requires?
Step 1: don't place the files in the Common Files folder;
create a subfolder for your applications, and place
the files there.
Step 2: Tell your applications to look in the Common
Files\Your Company Name\ folder for the DLLs.
There are 2 good ways to do this. Read the folder
path, either using the Registry or GetSpecialFolder
or GetSpecialPath APIs, and load the file with the
full path using LoadLibrary. For languages where this
isn't a good option (VB for one), use the
SetEnvironmentVariable API to add this folder to the
application (not system) path, before invoking any
functions within it.
You *can*, but you should not.
<URL:http://homepages.tesco.net./~J.deBoynePollard/FGA/dont-put-your-dll-in-the-system32-directory.html>
I think the application should not care where the DLL is (in fact it should
not even care if it _is_ a DLL or statically linked or whatever), but the
OS should. So there must be a way to start application X with a
speciallised path. What is this way on Win32?