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 LAA24636; Thu, 25 Jul 2002 11:36:15 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA24592 for ; Thu, 25 Jul 2002 11:36:15 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6P9aDT14186; Thu, 25 Jul 2002 11:36:13 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA24615; Thu, 25 Jul 2002 11:36:13 +0200 (MET DST) Date: Thu, 25 Jul 2002 11:36:13 +0200 From: Xavier Leroy To: Michael Tucker Cc: "Caml-List@Inria.Fr" Subject: Re: [Caml-list] CamlIDL and function pointers Message-ID: <20020725113613.A24406@pauillac.inria.fr> References: <20020723103916.B30947@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from mtucker@eecs.harvard.edu on Wed, Jul 24, 2002 at 11:00:29AM -0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Thanks for the help. I have seen another approach mentioned, but have not > been able to get it to work. I thought I could rewrite my struct for the > IDL as: > > typedef strcut funp { > int i; > } funp_t; > > But leave the C version intact. Supposedly it would just ignore the other > field when passing it through to Caml. Yes, that's a useful trick. However, ignoring the other field entirely doesn't do what you want when converting from Caml to C: > If that's the case, I was thinking > it might be possible to write the following in the IDL: > > void myfun ([in, unique] funp_t* f) > quote(call, > " _res = f->funp_fun ();"); Here, the CamlIDL-generated code will initialize f->i from the Caml data, and leave f->funp_fun uninitialized. (Remember, CamlIDL doesn't even *know* about the funp_fun field.) Hence, instant crash when you do f->funp_fun(). - Xavier Leroy ------------------- 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