[gtk-server] Re: R: Re: R: How to bind varargs functions
- From: Leonardo Cecchi <leonardoce@xxxxxxxxxxxx>
- To: gtk-server@xxxxxxxxxxxxx, administrator@xxxxxxxxxxxxxx
- Date: Wed, 21 Dec 2005 20:32:37 +0100
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
- Follow-Ups:
- [gtk-server] Re: R: Re: R: How to bind varargs functions
- From: Peter van Eerten
- References:
- [gtk-server] R: Re: R: How to bind varargs functions
- From: Leonardo Cecchi
- [gtk-server] Re: R: Re: R: How to bind varargs functions
- From: Peter van Eerten
Other related posts:
- » [gtk-server] R: Re: R: How to bind varargs functions
- » [gtk-server] Re: R: Re: R: How to bind varargs functions
- » [gtk-server] Re: R: Re: R: How to bind varargs functions
- » [gtk-server] Re: R: Re: R: How to bind varargs functions
- » [gtk-server] Re: R: Re: R: How to bind varargs functions
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
- [gtk-server] Re: R: Re: R: How to bind varargs functions
- From: Peter van Eerten
- [gtk-server] R: Re: R: How to bind varargs functions
- From: Leonardo Cecchi
- [gtk-server] Re: R: Re: R: How to bind varargs functions
- From: Peter van Eerten