I am developing a COM DLL using native unmanaged C++. I want to let all
object instance). Do you think it is implementable? Any reference
Actually, a DLL can be loaded in a process muiltiple times,
just not simultaneously. Once you unload a DLL you can load
it again into the same process. Of course the DLL's importlib
must not be linked to other images in the same process (the
executable image or that of any other DLLs loaded in the process)
or else you won't be able to unload the DLL in the first place...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message
news:eDU46ux6HHA.4436@TK2MSFTNGP03.phx.gbl...
George <George@discussions.microsoft.com> wrote:
I am developing a DLL and I implement a class in the DLL. I am
wondering in the two situations,
1. DLL is loaded by a single process multiple times
This cannot happen. If you attempt to load a DLL a second time, its
reference count is simply incremented.
2. DLL is loaded a couple of times by multiple process
How much times will the constructor be invoked?
As many times as an instance of the class is created. The number of
times
the DLL is loaded is irrelevant, unless you have a global instance
of
the
object. In which case, the constructor of each such object will run
once
every time a process loads the DLL.
I want to learn how
objects inside a DLL is shared between different process.
They aren't.
Is it
possible to make multiple process share one single class (class is
defined in DLL) object instance?
Not really. You can share simple data (fundamental types like
integers
or
doubles, and arrays and structs thereof). See
http://support.microsoft.com/kb/125677
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going
to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925