Date: Thu, 02 Dec 2004 11:14:10 +0900 (JST) Message-Id: <20041202.111410.09672730.garrigue at math.nagoya-u.ac.jp> To: furr at cs.umd.edu Cc: lablgtk at kaba.or.jp Subject: Re: Some FFI bugs in lablgtk From: Jacques Garrigue In-Reply-To: References: <20041201.104733.35026354.andrieu at ijm.jussieu.fr> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Michael Furr > On Wed, 1 Dec 2004, Olivier Andrieu wrote: > > It definitely can have ill effects. For instance, IIRC, this can crash > > the toplevel pretty quickly as it will try to inspect the value and > > print it. > I see how this would definately be a problem for functions which return > void instead of unit, but I don't see how it could crash the top level if > a parameter is just ignored on the C side(although, I must admit I'm not > very familiar with how the top-level does its value printing magic). > Since OCaml will actually place the value on the stack, if the toplevel > looks in the stack, it should find the correct value. I suppose Olivier mixed things with void-returning functions, which can crash the toplevel (and the GC) pretty fast. Toplevel printers don't contain any special stack searching, so I don't see how extra arguments when calling a C function might impact them in any way. The C calling convention is intended to allow passing extra arguments, and I have simply been using this fact to avoid a few extra characters. The only case where it might be problematic is if there were an architecture with a different calling convention. But you may be right that, as the generated code does not change anyway, these few extra characters need not be omitted. Jacques