Author: zoltan
Date: 2007-07-05 16:23:08 -0400 (Thu, 05 Jul 2007)
New Revision: 81434
Modified:
trunk/mono/mono/tests/ChangeLog
trunk/mono/mono/tests/libtest.c
trunk/mono/mono/tests/pinvoke3.cs
Log:
2007-07-05 Zoltan Varga <[EMAIL PROTECTED]>
* pinvoke3.cs libtest.c: Add new test for returning unicode strings
from a delegate.
Modified: trunk/mono/mono/tests/ChangeLog
===================================================================
--- trunk/mono/mono/tests/ChangeLog 2007-07-05 20:14:13 UTC (rev 81433)
+++ trunk/mono/mono/tests/ChangeLog 2007-07-05 20:23:08 UTC (rev 81434)
@@ -1,3 +1,7 @@
+2007-07-05 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * pinvoke3.cs libtest.c: Add new test for returning unicode strings
from a delegate.
+
2007-06-12 Zoltan Varga <[EMAIL PROTECTED]>
* pinvoke2.cs: Add test for instance delegates.
Modified: trunk/mono/mono/tests/libtest.c
===================================================================
--- trunk/mono/mono/tests/libtest.c 2007-07-05 20:14:13 UTC (rev 81433)
+++ trunk/mono/mono/tests/libtest.c 2007-07-05 20:23:08 UTC (rev 81434)
@@ -1887,7 +1887,23 @@
return 0;
}
+typedef gunichar2* (STDCALL *UnicodeStringDelegate) (gunichar2 *message);
+
STDCALL int
+mono_test_marshal_return_unicode_string_delegate (UnicodeStringDelegate del)
+{
+ const char m[] = "abcdef";
+ gunichar2 *s2, *res;
+ glong len;
+
+ s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
+
+ res = del (s2);
+
+ marshal_free (res);
+}
+
+STDCALL int
mono_test_marshal_out_string_array_delegate (char **arr, int len,
ArrayDelegate del)
{
del (len, NULL, arr);
Modified: trunk/mono/mono/tests/pinvoke3.cs
===================================================================
--- trunk/mono/mono/tests/pinvoke3.cs 2007-07-05 20:14:13 UTC (rev 81433)
+++ trunk/mono/mono/tests/pinvoke3.cs 2007-07-05 20:23:08 UTC (rev 81434)
@@ -874,6 +874,23 @@
}
/*
+ * Returning unicode strings
+ */
+ [return: MarshalAs(UnmanagedType.LPWStr)]
+ public delegate string
ReturnUnicodeStringDelegate([MarshalAs(UnmanagedType.LPWStr)] string message);
+
+ [DllImport ("libtest",
EntryPoint="mono_test_marshal_return_unicode_string_delegate")]
+ public static extern int
mono_test_marshal_return_unicode_string_delegate (ReturnUnicodeStringDelegate
d);
+
+ public static String return_unicode_string_delegate (string message) {
+ return message;
+ }
+
+ public static int test_0_marshal_return_unicode_string_delegate () {
+ return mono_test_marshal_return_unicode_string_delegate (new
ReturnUnicodeStringDelegate (return_unicode_string_delegate));
+ }
+
+ /*
* Returning string arrays
*/
public delegate string[] ReturnArrayDelegate (int i);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches