ATL, COM and coinitialize
Posted on 2001-06-02
I'm pretty new to ATL COM programming so bare with my ignorance, please...
I've written an ATL COM .Dll that populates a recordset and returns it to a VB caller. Everything works great. However, I'm not sure where I should (properly) call CoInitialize and ::CoUninitialize().
At first I called them in the beginning (and end) of each method but that seemed redundant.
So I started to call CoInitialize in InitInstance() and subsequently, ::CoUninitialize() in ExitInstance().
Will this be ok? Any memory leak problems with this style? Any problem with multiple instances? It seems to work but I need to be sure that this is solid programming!
Please advise and THANKS IN ADVANCE!