[gnome-db] Gda# Tests



I'm trying to test the following code:

                GLib.Value val = Gda.Value.NewString("Testing GDA#");
		
		Console.WriteLine("GValue: %s",(string) val);

And the code generated by api2-codegen use:

                [DllImport("gda-3")]
		static extern GLib.Value gda_value_new_string(IntPtr val);

		public static GLib.Value NewString(string val) {
			IntPtr val_as_native = GLib.Marshaller.StringToPtrGStrdup (val);
			GLib.Value raw_ret = gda_value_new_string(val_as_native);
			GLib.Value ret = raw_ret;
			GLib.Marshaller.Free (val_as_native);
			return ret;
		}

As I see, it calls the external function gda_value_new_string, and
return a GValue, this is correct; but when I try to print the string
using (string) val, I have the next message:

(./Main.exe:17065): GLib-GObject-CRITICAL **: g_value_get_string:
assertion `G_VALUE_HOLDS_STRING (value)' failed

Then the value is no initiated, any idea?
--
Trabajar, la mejor arma para tu superación



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