English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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-06 (11:13)
From: kyra <kyrab@m...>
Subject: Re: [Caml-list] OCam'OLE pre-release
> > Because the COM object can still be referenced from C.  You probably
> > forgot to do an AddRef somewhere, e.g. when extracting a COM object
> > reference from its Caml wrapper.
> >
> > Reference count management sure is tricky...
> True.
> If you're using OCamole to manipulate COM objects and then passing them
> to C, your C code need to call AddRef on the retreived COM object since
> OCamole GC'ed process does not respect the COM spec (caller is responsible
> from Release, callee call AddRef )
> Simply use the following function :
> IUnknown *get_com_object( value v ) {
>     IUnknown *o = IUnknown_val(v);
>     o->AddRef();
>     return o;
> }
> Nicolas Cannasse
I'd want to remind that original subject was 'olegen' application. Being
compiled natively it _does not work_. The error is access violation, caused
by "The object invoked has disconnected from its clients". I believe this is
because of Released COM object is invoked from _another COM object_. In my
first post on this topic I had conjectured this was design flaw - binding
Release with finalize. The main reason was:  _one cannot guarantee_ that
there are not other references to COM object from another COM objects. May
be one can suppose, but cannot guarantee. If I'm wrong, we must follow X.
Leroy and try to find the error in ocamole.cpp. If I'm wrong again, why does
olegen not work???

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