View Full Version : Should I put COM dlls in Common Files folder?

03-27-2004, 09:13 AM

I have a program, MyProgram, which uses various COM dlls. So far I've been using IE5 to distribute my program by default to C:\Program Files\MyCompany\MyProgram, with the COM dlls installed to a subfolder called dlls, i.e. to C:\Program Files\MyCompany\MyProgram\dlls\.

At the moment this is the only program that we are distributing, but we will soon have others which are also likely to make use of some of these same COM dlls. Should I therefore install the COM dlls instead to C:\Program Files\Common Files\MyCompany\ ?

Thanks for your help

03-28-2004, 03:44 PM
Shared DLL's should go into the WINDOWS system32 directory and be registered. When applications are installed that reference the same DLL the counter is incremented in the registry. As they are uninstalled the counter is likewise decremented. If the counter goes to 0 the object should be removed from the machine.


03-28-2004, 04:38 PM
With respect, thanks for the reply but I don't think that what you say is correct. Non COM dls should normally go in the Windows System folder (because Windows can't tell from the registry where they are), but COM dlls, which are self registering and hence tell Windows where they are, can go anywhere.
(I should add for completeness that the COM dlls I'm talking about are ones which we have created.)

In fact if you look in C:\Program Files\Common Files\ on your pc, you will find that several companies have put what are presumably COM dlls, e.g.:

- C:\Program Files\Common Files\Microsoft Shared\DAO (I know that the dlls here are COM dlls because we use them a lot!)
- C:\Program Files\Common Files\InstallShield\DemoShield

Since COM dlls could be put anywhere I agree that they COULD be put in the Windows System folder but that is already very cluttered, so I think that it is better to put them elsewhere (so that it is easier to tell if a user has all the dlls, and their correct versions - searching through Windows System would take at least 10 times as long and from experience it is not practical asking users over the phone to look through the system folder if there is a better alternative, which there is).

On thinking things through, C:Program Files\MyCompany\MyProgram\dlls\ is also not as good as c:\Program Files\Common Files\MyCompany\ because if you have MyProgram1 and MyProgram2, you could get 2 copies of the dlls installed, which is wasteful and could lead to confusion between different dll versions.

So it appears to me as if c:\Program Files\Common Files\MyCompany\ is the correct place to put COM dlls. However, if anyone at Install Shield thinks differently, I would be interested to know!


03-29-2004, 04:06 AM
Non-COM dlls can be placed in the application directory OR system directory. They are simply loaded using the loadlibrary calls and are not registered in the registry. Windows will look first in the application path and THEN in windows system folder before giving up.

The question was related to COM DLL's and they are registered along with the location used in regsvr32.exe (it automatically adds these details at registration), although it is not mandatory to have them in system directory, shared dlls would be better placed there.

Some companies locate their own proprietory dlls in the application folders or subfolders grouped by functionality. This again is good practice.

It is all about preference. I only place shared DLL's in system.

Also bear in mind that windows offers some protection against accidently deleting these by defaulting to 'Hidden System files and folders' in explorer.

It is only my opinion and there is no definitive 'correct' answer.