[gtk-server] Re: R: Re: R: How to bind varargs functions

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Mon, 26 Dec 2005 01:36:56 +0100

Just to finalize this thread: the GTK-server cannot read the memory of newLisp
(of course), nor vice versa. This is just an example; you should call the 'gtk'
function by value, and not by reference. (For the newLisp syntax I sent you a
private mail.)

Peter

Citeren Leonardo Cecchi <leonardoce@xxxxxxxxxxxx>:

> Thanks Peter for the prompt reply!
> Please help my to understand your code... the line:
>
> (set 'arg (address (pack "d" 64))))
>
> Store the address of the new allocated array in the arg variable right?
> But Gtk-Server runs in another process... how can he read the memory of the
> new-lisp process?
>
> Thanks and excuse me if the question is stupid.
>
> Leonardo
>
>
>
>
> Peter van Eerten ha scritto:
>
> >Hi Leonardo,
> >
> >>From your tracefile I see you are using the call "gtk_list_store_new".
> Looking
> >further into this GTK function it appears that the second argument is of a
> >C-type 'varargs'. This type cannot be converted by the GTK-server and is the
> >reason for the crash.
> >
> >Instead, use "gtk_list_store_newv", which, as the GTK documentation states,
> is
> >used by language bindings.
> >
> >The second argument of this GTK function however expects a pointer to an
> array
> >of integers. In newLisp I would implement this as follows, using your value
> for
> >G_TYPE_STRING:
> >
> >(set 'arg (address (pack "d" 64))))
> >(gtk "gtk_list_store_newv" 1 arg)
> >
> >
> >As you may see, the client language must have the capability to construct a
> C
> >pointer. Languages like newLisp and Perl can do that. But I am not sure if
> this
> >is also possible with CLisp.
> >
> >The prototype in the configfile would look like:
> >
> >GTK_LIB_FUNCTION = gtk_list_store_newv, NONE, WIDGET, 2, LONG, LONG
> >
> >
> >Best regards
> >Peter
> >
> >
>
>
>


-- 
http://www.gtk-server.org

Other related posts: