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: -- (:)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] OCam'OLE pre-release
 > But I must point out typical error (I saw exactly the same error in
> HDirect/COM library): ocaml finalization and com release are _essentially
> different_ entities! Sorry for not being sufficiently verbose - i have not
> enough time right now. If You doubt this is an issue - I will definitely
> clarify my point.

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 ).

For OLE , Release() doesn't not close the Application if it has been put
Visible to the user, but CoUninitiliaze will break the DDE and close it.
That's why i added the primitive "do_not_close" which prevent CoUninitialize
from being called, to enable Applications to remains open even if the ocaml

> Now only a few words: I've built native olegen version
> (having replaced CoInitialize/CoUninitialize call in DllMain with a call
> a static dummy class instance constructor/destructor), and discovered this
> olegen causes segmentaion fault! It turned out to be sufficient simply to
> comment out "i->Release();" in "com_finalize" to make it work.

That behavior should be explained by the following : Release() is called by
the GC, and OCamole perform a full_major cycle on "at_exit" of OCaml. But if
you call CoUnitialize perform having all the COM objects being properly
Released, it can freeze, or simply go on... but then a call to Release()
will cause a seg_fault.

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

Nicolas Cannasse

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