How can two process share a single dll in .net?

252 Views Asked by At

We have an VB6.0 ActiveX.exe which was getting data from 2 different instance of same process i.e. my activex.exe was running in its own memory and it was capable of getting data from its parent processes.

When the ActiveX.exe is migrated to VS 2008 ActiveX.exe lost its capability of running in its own process. As a result it got local to the instance of the parent process.

Is their any way where i can use a single dll that can be used by multiple parent process?

1

There are 1 best solutions below

2
On

The Windows loader will automatically use one in-memory physical copy of a DLL if it is loaded by multiple processes. There's nothing you need to do to enable this behavior.

If you want to share data across processes, you need to use normal interprocess communication mechanisms, such as pipes, sockets, files, shared memory segments, etc. that can be secured correctly.

(Previously it was somewhat common for programs to create a shared writable memory segment in their PE file and try to share data that way; but that allows any user who can load the DLL, (which is functionally all of them) to party with the data just by loading the DLL in question....)