Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] OCam'OLE pre-release
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-08-03 (21:32)
From: Quetzalcoatl Bradley <qbradley@m...>
Subject: RE: [Caml-list] OCam'OLE pre-release

It is not safe to use any COM object, including calling Release on it, after
calling CoUninitialize.  Also in my experience there is much danger in
relying on the order of constructor and destructor call of static variables
to manage lifetime of COM objects or CoInitialize/CoUnitialize call.

Move your CoUnitialize call out of a static variable and into the last
statement of your program.  Since the GC will not run after your
CoUnitialize call, no Release calls will be made on any COM object after
CoUnitialize.  Alternatively, do whatever is necessary to make sure that all
your COM objects are released before your program exits (perhaps by making
sure there is no reachable COM object and then doing a "full major" garbage

Quetzalcoatl Bradley

-----Original Message-----
[]On Behalf Of kyra
Sent: Friday, August 02, 2002 4:26 PM
To: Nicolas Cannasse; OCaml
Subject: Re: [Caml-list] OCam'OLE pre-release

> Yes, i would actually ear your arguments about that point, because it does
> not seems clear to me : the AddRef/Release semantic of COM is a reference
> counting to enable the sharing of object and thus determine its time-life
>  the last Release() call will trigger effective memory release of the
> object ).

But ocaml variable and COM reference are merely different things.

> Simply modify ocamole in order to not call "i->Release()" if
> had been made, or ( better ) GC'd all your COM objects before calling
> ComUninit.

This does not work. Even not to call CoUninitialize does not work. There is
the same access violation (not segfault as i've early mentioned) error
everywhere: "The object invoked has disconnected from its clients". I am in
no way ocaml or COM expert, but it seems this is because ocaml not only GCs
_unneeded variable_ but also Releases _still needed_ interface.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list:
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: