R
Robert Rossney
I have built a .NET COM object that's being instantiated by a (non-.NET) C++
application, using the following code:
CoInitialize(NULL);
IMyInterface *pCOMObject = NULL;
HRESULT hr = CoCreateInstance(CLSID_MyDotNetClass,
NULL,
CLSCTX_INPROC_SERVER,
IID_IMyInterface,
reinterpret_cast<void**> (&pCOMObject));
if (SUCCEEDED(hr)) {
pCOMObject->Method(params);
pCOMObject->Release();
pCOMObject=NULL;
}
CoUninitialize();
The object gets created, the method gets called, the parameters get
passed...from that perspective, everything's working.
But the object doesn't seem to get destroyed when I release it. The
object's destructor never gets called, and the DLL containing the object's
code remains locked until the C++ application terminates. This seems wrong
to me -- especially since the above code is itself in a dynamically-loaded
function, and I can happily rebuild *its* DLL while the calling application
is running.
Is there something obvious I'm doing wrong here?
Thanks in advance,
Robert Rossney
(e-mail address removed)
application, using the following code:
CoInitialize(NULL);
IMyInterface *pCOMObject = NULL;
HRESULT hr = CoCreateInstance(CLSID_MyDotNetClass,
NULL,
CLSCTX_INPROC_SERVER,
IID_IMyInterface,
reinterpret_cast<void**> (&pCOMObject));
if (SUCCEEDED(hr)) {
pCOMObject->Method(params);
pCOMObject->Release();
pCOMObject=NULL;
}
CoUninitialize();
The object gets created, the method gets called, the parameters get
passed...from that perspective, everything's working.
But the object doesn't seem to get destroyed when I release it. The
object's destructor never gets called, and the DLL containing the object's
code remains locked until the C++ application terminates. This seems wrong
to me -- especially since the above code is itself in a dynamically-loaded
function, and I can happily rebuild *its* DLL while the calling application
is running.
Is there something obvious I'm doing wrong here?
Thanks in advance,
Robert Rossney
(e-mail address removed)