: No. All is well.
:
[quoted text clipped - 9 lines]
: If you need deterministic cleanup of a .NET object, implement IDisposable
: and call IDisposable.Dispose from the client code.
You know, I actually already knew all this. But I knew it on paper. Now I
know it for real.
Also: I see now from various documents I'm reading about managing the
lifetime of COM objects that the delete operator and COM objects don't mix,
and that setting the pointer to NULL was in fact the right thing to do after
calling Release() on it. Deleting the object fired the destructor, but it
caused very bad things to happen.
: As for the .DLL, when you call CoCreateObject to create the COM-Callable
: wrapper for the .NET object, the CLR is fired up in your process and the
: target assembly is loaded into the default AppDomain. The CLR, the default
: App Domain and your assembly will remain loaded for the duration of your
: process.
That makes sense. It's annoying, because I can presently move a new build
of the C++ DLL into production without forcing all users to log off first,
and I won't once the DLL starts calling .NET objects, but it makes sense.
On the other hand, that also means that the CLR and the assembly aren't
being freshly loaded every time my object gets created, so really it's
better this way.
I went down this whole road because I wanted to make sure that my object was
getting destroyed, and when I implemented a destructor I found that it
wasn't. I think that maybe I'll just trust COM to do its job and worry
about other things.
Thanks for your help.
Robert Rossney
rbr@well.com