Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
collection?)

Quetzalcoatl Bradley
qbradley@blackfen.com


-----Original Message-----
From: owner-caml-list@pauillac.inria.fr
[mailto:owner-caml-list@pauillac.inria.fr]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
CoUninitialize
> 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 caml-list-request@inria.fr Archives:
http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners