` Printed Icetips Article

Icetips Article



COM: Uninitalizing COM objects 2
2004-01-18 -- Andy Ireland
 
Newsgroups: softvelocity.public.clarion6


Hi Carl,

> When I looked an the CComInitter Destruct method it does not appear to call
> CoUNinit if S_False was returned for the CoInit.

It's a bug then.

> Also does CoInit really need to be called per thread? MSDN clearly says it
> does, but the book "Inside COM" says per Process.

Yes. This however highlights the inconsistences of various sources and may
accout for the CoInit bug whether from a book or some source saying it
really didn't matter. Remeber this code was originally written a long time
ago now. But it is per thread. You will get an error if not inited on each
thread when you come to use an interface. You also must marshal interfaces
across threads unless the default proxy stub does it for you. The proxy stub
should in most cases but not in all.

Regards

Andy



Printed November 21, 2024, 7:22 am
This article has been viewed/printed 35380 times.