From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA14566; Tue, 6 Aug 2002 13:13:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA14750 for ; Tue, 6 Aug 2002 13:13:13 +0200 (MET DST) Received: from mx5.mail.ru (mx5.mail.ru [194.67.57.15]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g76BDC102503 for ; Tue, 6 Aug 2002 13:13:12 +0200 (MET DST) Received: from [213.171.63.98] (helo=kyra) by mx5.mail.ru with smtp (Exim SMTP.5) id 17c2H1-000166-00; Tue, 06 Aug 2002 15:13:11 +0400 Message-ID: <002d01c23d42$fc4d1080$551aa8c0@kyra> From: "kyra" To: "Nicolas Cannasse" Cc: "OCaml" References: <000901c237fe$04a92510$0700a8c0@warp> <001901c239b4$be8ccbf0$551aa8c0@kyra> <001101c23a0d$2f184220$0700a8c0@warp> <000d01c23ae3$9dd62700$551aa8c0@kyra> <003b01c23c54$32324570$0700a8c0@warp> <20020805113255.C7554@pauillac.inria.fr> <003901c23c65$9fe95e30$0700a8c0@warp> Subject: Re: [Caml-list] OCam'OLE pre-release Date: Tue, 6 Aug 2002 15:15:41 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > 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 back > 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