guile-gtk-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create a variable of the <gint*> type?


From: Andy Wingo
Subject: Re: How to create a variable of the <gint*> type?
Date: Sun, 06 May 2007 21:13:25 +0200

Hi Milan,

On Mon, 2006-01-09 at 01:09 +0100, Milan Zamazal wrote:
> In my scheme code I need to call a guile-gnome function
> (`window-to-buffer-coords') that requires arguments of the type <gint*>.
> But I couldn't find a way how to create a variable of that type.  Could
> you help me please?

This type no longer exists in Scheme. Consider a function like the
following:

  gboolean gtk_icon_size_lookup (GtkIconSize size, gint *w, gint *h);

The gint* is a C way of providing for multiple return values. In Scheme
we can do better, returning multiple values directly. The bindings
generator automatically recognizes int* arguments as output arguments;
that is, it is expected that gtk_icon_size_lookup will initialize them,
and the wrapper returns those values. The same happens with any other
scalar argument, such as gboolean*, or GQuark*.

There are cases in which the * indicates something else, however, for
example an array. In those cases, we have to wrap the functions
manually. However in the GTK+ API, the *-as-output-argument idiom is
much more common.

Regards,

Andy.
-- 
http://wingolog.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]