On Sunday 05 April 2009 10:50:43 Michael B. Trausch wrote:

> Another question I have where I am trying to figure out if I am doing
> it wrong, or if there is a bug:
>
> glib-2.0.vapi:1229.2-1229.18: error: The value type `GLib.Pid` doesn't
> declare a GValue set function
>         public struct Pid {
>       ^^^^^^^^^^^^^^^^^
>
> I am clueless as to why it wants something else.  I thought a GLib.Pid
> was an integer value.
>
> This is with Vala 0.6 release.

I had the same error today.

Following the GLib headers, I saw that *in Linux* a GPid is in the end a 
pid_t, that in the end is a 32 bit integer.

What I did was to copy part of the GLib vapi into a seperate vapi file and 
there I copied the vapi directives of gint. It worked.

I'd propose the attached patch to correct GLib vapi, but I'm not sure if it 
should be added to Vala because I've read in other mails that in Windows GPid 
is a pointer and not an integer.

Regards.

-- 
Enrique Ocaña


From c5e5bf3d355bbfda072b11f692bb5d9fc7829949 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <[email protected]>
Date: Fri, 18 Sep 2009 21:04:46 +0200
Subject: [PATCH] Corrects error 'The value type `GLib.Pid` doesn't declare a GValue set function' on Pid

by considering GPid an integer
---
 vapi/glib-2.0.vapi |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index c62b34d..877f315 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1270,10 +1270,10 @@ namespace GLib {
 		public static bool remove_by_data (void* data);
 	}
 
-	[SimpleType]
-	[CCode (default_value = "0")]
-	public struct Pid {
-	}
+    [SimpleType]
+    [CCode (cname = "gint", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", type_signature = "i")]
+    public struct Pid {
+    }
 
 	public delegate void ChildWatchFunc (Pid pid, int status);
 	
-- 
1.6.0.4

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to