Date: Tue, 15 Mar 2005 15:23:58 +0900 (JST) Message-Id: <20050315.152358.111179216.garrigue at math.nagoya-u.ac.jp> To: robertr at rftp.com Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: Relationship of LablGTK/GTK signal processing From: Jacques Garrigue In-Reply-To: <423555E6.7060202 at rftp.com> References: <423212DE.5090007 at rftp.com> <20050312.162426.68555891.garrigue@kurims.kyoto-u.ac.jp> <423555E6.7060202@rftp.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Robert Roessler > In any case, I can "see" the events in OCaml code - as long as I just > want to see the int, I can use a "GtkSignal.t" record that looks like > > {name="sci-notify"; classe=`scintilla; marshaller=marshal_int} > > and this in fact works as expected (using some of my Scintilla widget > control methods, I can control what integer is emitted in subsequent > events, so I know I am properly receiving the value in my OCaml callback). > > So while GtkSignal.marshal_int works to get the int, I don't see a > marshal_int_and_pointer (ha-ha), nor do I see immediately how to > compose one from the available pieces - yet it is obviously possible, > and very likely quite easy. :( Just below marshal_int, you have a function called marshal2. So, to do what you asked for, you have to write open Gobject.Data let marshal_int_pointer = GtkSignal.marshal2 int pointer Simple, isn't it? Note that the above code code doesn't attempt to do anything about the pointer. It just allows you to get a hand on it, and eventually call a C function that will use it. No memory management is done. Note also that this pointer is "boxed", ie. the actuall pointer is in the second field of an abstract ocaml block, which you can access on the C side as Field(p,1). Jacques