PDA

View Full Version : Private DLL


cdundee
08-16-2007, 11:48 AM
Hi Brett,
I have a question about private DLL in SUFWI.

There is an option in SUFWI to register a DLL as private to an application. Does the installer do anything special to make a DLL private to an application or does it merely copy the DLL to the application folder and register as a non-shared component? How does the installer make a DLL private?

I always thought that a DLL can be private by simply placing it in the application folder and registering it as a non-shared DLL.

Can you please take some time and respond as soon as possible.

Thanks.

Brett
08-16-2007, 11:54 AM
Is the DLL that you are using:

1) A COM (ActiveX) DLL?
2) A .NET DLL?
3) A normal, win32 DLL?

In general, yes, putting a DLL in the same folder as the executable will make the executable use it from that location. However, if the DLL requires COM registration, you probably want to install it to the system folder and keep a DLL shared count on it.

cdundee
08-16-2007, 12:40 PM
It is a COM (ActiveX) DLL.

In SUFWI, I added this DLL file. There are two choices available to me:
1. If I want to make the DLL a shared one, I will have to install it in system32 folder and register as a shared DLL. To accomplish this, In SUFWI, I specify the destination directory as system32, I select the self register radio button and check the shared DLL reference count checkbox on the component properties.

2. If I want to make the DLL private to my application, I will have to install it in the application folder and register as a non-shared component. To accomplish this, In SUFWI, I specify the destination directory as my application folder, I select the self register radio button and uncheck the shared DLL reference count checkbox on the component properties.

Option 1 works for me but Option 2 does not seem to work for me when I install two different applications (using two different setups) that use the same DLL as private to them. When I uninstall one application the DLL gets unregistered and breaks the other application.

If I use option 2 or want to make a DLL private, in SUFWI do I also have to select private on the Registration Type on the Assembly Settings page?

Thanks.

Brett
08-16-2007, 01:22 PM
For option 2, what you may want to do is to make the DLL an isolated component for the executable. To do this:

1. Install the DLL to the system folder
2. Mark it as self-registered
3. Mark its component as shared
4. Go to the file properties for the executable that uses the DLL
5. Go to the Component tab and click Edit Component
6. Go to the Advanced tab
7. Add the dll's component to the Isolated Components list

I am not sure if that is what you are after, but it is worth a try...

Lorne
08-17-2007, 09:40 AM
2. If I want to make the DLL private to my application, I will have to install it in the application folder and register as a non-shared component. To accomplish this, In SUFWI, I specify the destination directory as my application folder, I select the self register radio button and uncheck the shared DLL reference count checkbox on the component properties.You could try using .Local.

See:
http://blogs.msdn.com/junfeng/archive/2006/01/24/517221.aspx
and:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dynamic_link_library_redirection.asp

For example, if you create an empty file in the same folder, with the same name as your executable plus a ".local" suffix (e.g. appname.exe.local), that will make your application search its local directory for its libraries (unless there is a manifest file present, which will override the .local).