How do I free SQLServerCE's COM instance from the current running process?

Posted by David Thornley on Stack Overflow See other posts from Stack Overflow or by David Thornley
Published on 2009-12-02T02:16:49Z Indexed on 2010/05/23 2:10 UTC
Read the original article Hit count: 478

Filed under:
|
|
|

It's been a while since I touched COM so be nice ;) This is under WindowsCE 5.0 with SQLServerCE 2.0.

After calling this to load SQLServerCE 2.0 : -

IDBInitialize *pIDBInitialize = NULL;
CoCreateInstance(CLSID_SQLSERVERCE_2_0, NULL, CLSCTX_INPROC_SERVER, IID_IDBInitialize, (void**)&pIDBInitialize);

Module load occurs for SSCE20.dll which obviously loads the SQLServerCE engine into the process space.

What I don't understand is if I do this immediately after :-

pIDBInitialize->Release();

I don't see a dll module unload, so that SSCE20.dll (and friends) are still loaded into my process.

Now I tried CoFreeUnusedLibraries() which I figure forces COM to purge any unused libraries, but it doesn't seem to do the trick.

At runtime I want to be able to completely unload the SQLServerCE 2.0 dll from the process to streamline an upgrade to 3.5SP1.

I suspect this has something to do with the shared dll model that Microsoft use under WindowsCE... but, I might be wrong :)

Thanks in advance,

David.

© Stack Overflow or respective owner

Related posts about c++

Related posts about sql